Solved Codingbat problem