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