Codingbat.com string-1 exercise solved.