#!/usr/bin/ruby

# The mapper for the simple count application: output the number of sentences a word appears in.

# The mapper reads sentences from the standard input, and outputs
# the distinct words in each sentence

while (line = gets)
  encountered_words = Hash.new
  line.split.each {|word| encountered_words[word] = true}
  encountered_words.keys.each{ |word|  print word, "\t", 1, "\n"}
end
