fork(3) download
  1. import fileinput
  2. err = False
  3. for line in fileinput.input():
  4. line = line.rstrip('\n')
  5. if line != "".join(sorted(line)):
  6. err = True
  7. print("[%d] Bad line: %s" % (fileinput.lineno(), line))
  8.  
  9. if not err:
  10. print("All ok!")
  11.  
Success #stdin #stdout 0.02s 8688KB
stdin
Press edit.
Then paste code here. 
stdout
[1] Bad line: Press edit.
[2] Bad line: Then paste code here.