fork(1) download
  1. import collections
  2.  
  3. f = open("input.txt")
  4.  
  5. for _ in f:
  6. c = collections.Counter(input().split())
  7. words, length = [], 0
  8. for w, c in c.most_common():
  9. length = max(length, c)
  10. if length != c:
  11. break
  12. words.append(w)
  13. words.sort()
  14. print(words[0])
  15.  
  16. #Test 3
  17. #input:
  18. #q w e r t y u i o p
  19. #a s d f g h j k l
  20. #z x c v b n m
  21. #Wrong answer.
  22. #correct output:
  23. #a
Runtime error #stdin #stdout #stderr 0.02s 28384KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 3, in <module>
FileNotFoundError: [Errno 2] No such file or directory: 'input.txt'