Anagram (Map Reduce)
还是一样注意字符串处理就好了
class Anagram:
# @param {str} line a text, for example "Bye Bye see you next"
def mapper(self, _, line):
# Write your code here
# Please use 'yield key, value' here
for word in line.split():
yield ''.join(sorted(word)), word
# @param key is from mapper
# @param values is a set of value with the same key
def reducer(self, key, values):
# Write your code here
# Please use 'yield key, value' here
yield key, list(values)