fork(1) download
  1. #Old code, here print statement appends a newline automatically
  2. #import sys
  3. ##sys.stdin = open ("Input.txt")
  4. ##sys.stdout = open ("Output.txt", "w")
  5. #
  6. #def main():
  7. # for line in sys.stdin:
  8. # print line
  9. #
  10. #main()
  11.  
  12. #New code, Note the comma after the print statement, which prevents Python from printing the new line
  13. import sys
  14. #sys.stdin = open ("Input.txt")
  15. #sys.stdout = open ("Output.txt", "w")
  16.  
  17. def main():
  18. for line in sys.stdin:
  19. for data in line.split():
  20. print data,
  21. print ""
  22.  
  23. main()
  24.  
Success #stdin #stdout 0.08s 8840KB
stdin
3
7 4
2 4 6
8 5 9 3
stdout
3 
7 4 
2 4 6 
8 5 9 3