http://codingbat.com/prob/p234273