text is what someone typed on a keyboard, one letter at a time. A key switch happens when a letter is typed with a different key than the letter before it.
Shift and Caps Lock do not matter: a and A come from the same key.
Return how many times the typist switched keys.text="HelLo" → 3
H→e is a new key, e→l is a new key, l→L is the same key with Shift, L→o is a new key. That makes 3.
text="mMmM" → 0
The same m key is pressed every time; case does not count.
text="Q" → 0
text consists only of lowercase and uppercase English letterstext="HelLo"
3
Run checks the first 3 tests in your browser. Submit checks all 75 tests on the server, hidden ones included.