Count Case-Insensitive Key Changes
Problem statement
You are given a nonempty string recording of uppercase and lowercase English letters typed in order.
Uppercase and lowercase versions of the same letter use the same physical key. Return how many adjacent transitions change to a different key after case normalization.
Function
countKeyChanges(recording: String) → intExamples
Example 1
recording = "aAbBc"return = 2After normalization the sequence is a, a, b, b, c, which changes twice.
Example 2
recording = "Zz"return = 0Both characters use the same key.
Constraints
1 <= recording.length <= 100000recordingcontains only English letters.