http://codingbat.com/prob/p238161