Beautiful Strings Programming Problem
String s is called unique if all the characters of s are different.
String s2 is producible from string s1, if we can remove some characters of s1 to obtain s2.
String s1 is more beautiful than string s2 if length of s1 is more than length of s2 or they have equal length and s1 is lexicographically greater than s2.
Given a string s you have to find the most beautiful unique string that is producible from s.
First line of input comes a string s having no more than 1,000,000(10^6) characters. all the characters of s are lowercase english letters.
Print the most beautiful unique string that is producable from s
In the above test case all unique strings that are producible from s are “ab” and “ba” and “ba” is more beautiful than “ab”.