http://codingbat.com/prob/p277929