code for mapreduce exercise 2 added