http://codingbat.com/prob/p267620