text of lowercase and uppercase English letters. Whenever the same letter appears in two different cases side by side (say q and Q, in either order), that pair can be removed. Removing it brings new characters together, and this repeats until nothing more can be removed.
Return the string that is left at the end. It does not depend on the order of removals; an empty string is a valid answer too.text='xYyz' → 'xz'
Yy is the same letter in two cases, so the pair vanishes and xz remains.
text='kBbaAK' → ''
Bb and aA go first; then k and K end up next to each other and go as well.
text='aa' → 'aa'
Equal letters in the same case do not cancel each other.
text='xYyz'
'xz'
Run checks the first 3 tests in your browser. Submit checks all 107 tests on the server, hidden ones included.