import java.util.Set;
import java.util.HashSet;
class StringUtilities
{
public static void main
(String[] args
) {
System.
out.
println("Test string \"" + test
+ "\" with duplicates removed is: \"" + removeDuplicates
(test
) + "\""); }
Set<Character> knownCharacters = new HashSet<>(input.length());
StringBuilder noDuplicates = new StringBuilder(input.length());
for(char character : input.toCharArray()){
if(!knownCharacters.contains(character)){
knownCharacters.add(character);
noDuplicates.append(character);
}
}
return noDuplicates.toString();
}
}
aW1wb3J0IGphdmEudXRpbC5TZXQ7CmltcG9ydCBqYXZhLnV0aWwuSGFzaFNldDsKCmNsYXNzIFN0cmluZ1V0aWxpdGllcwp7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbihTdHJpbmdbXSBhcmdzKQoJewogICAgCVN0cmluZyB0ZXN0ID0gIkJhbmFuYSI7CiAgICAKCQlTeXN0ZW0ub3V0LnByaW50bG4oIlRlc3Qgc3RyaW5nIFwiIiArIHRlc3QgKyAiXCIgd2l0aCBkdXBsaWNhdGVzIHJlbW92ZWQgaXM6IFwiIiArIHJlbW92ZUR1cGxpY2F0ZXModGVzdCkgKyAiXCIiKTsKCX0KCQoJcHVibGljIHN0YXRpYyBTdHJpbmcgcmVtb3ZlRHVwbGljYXRlcyhmaW5hbCBTdHJpbmcgaW5wdXQpIHsKCQlTZXQ8Q2hhcmFjdGVyPiBrbm93bkNoYXJhY3RlcnMgPSBuZXcgSGFzaFNldDw+KGlucHV0Lmxlbmd0aCgpKTsKICAgIAlTdHJpbmdCdWlsZGVyIG5vRHVwbGljYXRlcyA9IG5ldyBTdHJpbmdCdWlsZGVyKGlucHV0Lmxlbmd0aCgpKTsKCgkgICAgZm9yKGNoYXIgY2hhcmFjdGVyIDogaW5wdXQudG9DaGFyQXJyYXkoKSl7CgkgICAgICAgIGlmKCFrbm93bkNoYXJhY3RlcnMuY29udGFpbnMoY2hhcmFjdGVyKSl7CgkgICAgICAgIAlrbm93bkNoYXJhY3RlcnMuYWRkKGNoYXJhY3Rlcik7CgkgICAgICAgICAgICBub0R1cGxpY2F0ZXMuYXBwZW5kKGNoYXJhY3Rlcik7CgkgICAgICAgIH0KCSAgICB9CgkgICAgcmV0dXJuIG5vRHVwbGljYXRlcy50b1N0cmluZygpOwogICAgfQp9