text of lowercase English letters. It gets erased in rounds. In one round, for every letter from a to z, the leftmost occurrence of that letter (if any) is deleted from the string. All other characters keep their order.
Rounds repeat until the string is empty.
Return the string as it looked right before the final round, the one that leaves nothing behind.
For example, text = "banana" goes "banana" → "ana" → "a" → "", so the answer is "a".text='banana' → 'a'
Round 1 removes the first "b", "a" and "n", leaving "ana". Round 2 removes the first "a" and "n", leaving "a". Round 3 removes it and the string is empty, so the answer is "a".
text='xyzzyx' → 'zyx'
Round 1 removes the first "x", "y" and "z", leaving "zyx". Round 2 removes everything.
text='cab' → 'cab'
text consists only of lowercase English letterstext='banana'
'a'
Run checks the first 3 tests in your browser. Submit checks all 43 tests on the server, hidden ones included.