http://codingbat.com/prob/p155713