Use range-based for loop in TopCoder's problem TypoCoder