import re m = """0 1 2 3 4 51 0 1 2 3 42 1 1 2 3 4"""repl = 'bip' print (re.sub(r'\n', '\n{} ', m, len(repl)).format(*list(repl)))
Standard input is empty
b 0 1 2 3 4 5 i 1 0 1 2 3 4 p 2 1 1 2 3 4
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!