http://codingbat.com/prob/p246963