problem 4 using two emits in reduce