http://codingbat.com/prob/p118044