http://codingbat.com/prob/p251871