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. *Input:* 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. *Output:* Print the most beautiful unique string that is producable from s *Sample Input:* babab *Sample Output:* ba *Explanation* In the above test case all unique strings that are producible from s are "ab" and "ba" and "ba" is more beautiful than "ab". -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.