You are given a string s typed by a user. Changing a key is defined as typing a character that is different from the immediately preceding character, ignoring letter casing.
Return the number of times the key was changed while typing s.
Note: Modifiers such as Shift or Caps Lock do not count toward a key change. For instance, typing
'a'followed by'A'uses the same key.
Constraints:
s.length
s consists of only upper case and lower case English letters.
You are given a string s typed by a user. Changing a key is defined as typing a character that is different from the immediately preceding character, ignoring letter casing.
Return the number of times the key was changed while typing s.
Note: Modifiers such as Shift or Caps Lock do not count toward a key change. For instance, typing
'a'followed by'A'uses the same key.
Constraints:
s.length
s consists of only upper case and lower case English letters.