FunctionRacerProblemsRace

Alternating Case

BeginnerStringsPython, JavaScript, TypeScript, Java, C++

Go through the letters of s and count only the letters (skip every other character). Make the 1st, 3rd, 5th... letters uppercase and the 2nd, 4th, 6th... letters lowercase. Characters that are not letters stay as they are. Return the new string.

Example 1

s "hello world"
returns "HeLlO wOrLd"

Letters alternate across the space: HeLlO wOrLd.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Strings problems