S&P Global Interview Question

repeatedly remove duplicate characters in a string