import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Set;
import java.util.TreeSet;
import java.io.BufferedReader;
public class Main {
private static boolean isLetter(char c) {
return ('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z');
}
StringBuilder currentWord = new StringBuilder();
boolean wasLetter = false;
while (reader.ready()) {
char c = (char)reader.read();
if (isLetter(c)) {
currentWord.append(c);
wasLetter = true;
} else if (wasLetter) {
uniqueWords.add(currentWord.toString());
currentWord = new StringBuilder();
wasLetter = false;
}
}
if (currentWord.length() != 0) {
uniqueWords.add(currentWord.toString());
}
}
Set<String> uniqueWords = new TreeSet<>();
parseToWords(reader, uniqueWords);
for (String currentWord
: uniqueWords
) { System.
out.
println(currentWord
); }
}
}
aW1wb3J0IGphdmEuaW8uSU9FeGNlcHRpb247CmltcG9ydCBqYXZhLmlvLklucHV0U3RyZWFtUmVhZGVyOwppbXBvcnQgamF2YS51dGlsLlNldDsKaW1wb3J0IGphdmEudXRpbC5UcmVlU2V0OwppbXBvcnQgamF2YS5pby5CdWZmZXJlZFJlYWRlcjsKCnB1YmxpYyBjbGFzcyBNYWluIHsKICAgIHByaXZhdGUgc3RhdGljIGJvb2xlYW4gaXNMZXR0ZXIoY2hhciBjKSB7CiAgICAgICAgcmV0dXJuICgnQScgPD0gYyAmJiBjIDw9ICdaJykgfHwgKCdhJyA8PSBjICYmIGMgPD0gJ3onKTsKICAgIH0KCiAgICBwcml2YXRlIHN0YXRpYyB2b2lkIHBhcnNlVG9Xb3JkcyhCdWZmZXJlZFJlYWRlciByZWFkZXIsIFNldDxTdHJpbmc+IHVuaXF1ZVdvcmRzKSB0aHJvd3MgSU9FeGNlcHRpb24gewogICAgICAgIFN0cmluZ0J1aWxkZXIgY3VycmVudFdvcmQgPSBuZXcgU3RyaW5nQnVpbGRlcigpOwogICAgICAgIGJvb2xlYW4gd2FzTGV0dGVyID0gZmFsc2U7CiAgICAgICAgd2hpbGUgKHJlYWRlci5yZWFkeSgpKSB7CiAgICAgICAgICAgIGNoYXIgYyA9IChjaGFyKXJlYWRlci5yZWFkKCk7CiAgICAgICAgICAgIGlmIChpc0xldHRlcihjKSkgewogICAgICAgICAgICAgICAgY3VycmVudFdvcmQuYXBwZW5kKGMpOwogICAgICAgICAgICAgICAgd2FzTGV0dGVyID0gdHJ1ZTsKICAgICAgICAgICAgfSBlbHNlIGlmICh3YXNMZXR0ZXIpIHsKICAgICAgICAgICAgICAgIHVuaXF1ZVdvcmRzLmFkZChjdXJyZW50V29yZC50b1N0cmluZygpKTsKICAgICAgICAgICAgICAgIGN1cnJlbnRXb3JkID0gbmV3IFN0cmluZ0J1aWxkZXIoKTsKICAgICAgICAgICAgICAgIHdhc0xldHRlciA9IGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChjdXJyZW50V29yZC5sZW5ndGgoKSAhPSAwKSB7CiAgICAgICAgICAgIHVuaXF1ZVdvcmRzLmFkZChjdXJyZW50V29yZC50b1N0cmluZygpKTsKICAgICAgICB9CiAgICB9CgogICAgcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncykgdGhyb3dzIElPRXhjZXB0aW9uIHsKICAgICAgICBCdWZmZXJlZFJlYWRlciByZWFkZXIgPSBuZXcgQnVmZmVyZWRSZWFkZXIobmV3IElucHV0U3RyZWFtUmVhZGVyKFN5c3RlbS5pbikpOwogICAgICAgIFNldDxTdHJpbmc+IHVuaXF1ZVdvcmRzID0gbmV3IFRyZWVTZXQ8PigpOwogICAgICAgIHBhcnNlVG9Xb3JkcyhyZWFkZXIsIHVuaXF1ZVdvcmRzKTsKICAgICAgICBmb3IgKFN0cmluZyBjdXJyZW50V29yZCA6IHVuaXF1ZVdvcmRzKSB7CiAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbihjdXJyZW50V29yZCk7CiAgICAgICAgfQogICAgfQp9