C3 AI interview question

Coding question: string input, you can remove all but one instance of a character from the string. Return the Lexicographically maximal string