fork download
  1.  
  2. # import sys because we need to read and write data to STDIN and STDOUT
  3. import sys
  4.  
  5. # reading entire line from STDIN (standard input)
  6. for line in sys.stdin:
  7. # to remove leading and trailing whitespace
  8. line = line.strip()
  9. # split the line into words
  10. words = line.split()
  11.  
  12. # we are looping over the words array and printing the word
  13. # with the count of 1 to the STDOUT
  14. for word in words:
  15. # write the results to STDOUT (standard output);
  16. # what we output here will be the input for the
  17. # Reduce step, i.e. the input for reducer.py
  18. print(f"{word,1}")
Success #stdin #stdout 0.03s 9568KB
stdin
hi how are you you you
stdout
('hi', 1)
('how', 1)
('are', 1)
('you', 1)
('you', 1)
('you', 1)