My solution for harvard 2014 home work 2 problem.