http://codingbat.com/prob/p226941