http://codingbat.com/prob/p235070