Given a sequence of uppercase letters, we want to remove all but one occurrence of each
letter, doing it in such a way that the
remaining letters are in alphabetical order. Of course, there may be no way to
do this, but if there is, we want to know which letters to remove.
Create a class MakeUnique that contains a method eliminated that is given a
String original, and returns original with the
eliminated letters replaced with periods ('.'). The remaining letters must
be in alphabetical order.
If there is no way to do this, return a String with length 0.
If there are several ways to do this, choose the one with the shortest length
between the first and last remaining letters. If there are still several ways,
return the String among these that comes earliest lexicographically ('.' comes
earlier than any letter in the ASCII sequence).
|