http://codingbat.com/prob/p276652