Yonghao's codingbat exercise 2

This is my second codingbad exercise.

My link is here:

http://yonghaoy.github.io/spring2014/2014/02/14/yonghao%27s-codingbat2.html