import fileinput err = False for line in fileinput.input(): line = line.rstrip('\n') if line != "".join(sorted(line)): err = True print("[%d] Bad line: %s" % (fileinput.lineno(), line)) if not err: print("All ok!")
Press edit. Then paste code here.
[1] Bad line: Press edit. [2] Bad line: Then paste code here.
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!