S&P Global interview question

repeatedly remove duplicate characters in a string