#include <iostream>
#include <cstring>
using namespace std;
const int MAX_SIZE = 2000;
bool hasDistinctLetters(char word[], int len) {
const int LAST_LETTER = 'z';
int fr[LAST_LETTER] = {0};
for (int i = 0; i < len; ++i) {
++fr[word[i]];
if (fr[word[i]] > 1) {
return false;
}
}
return true;
}
bool moreAbsurd(char firstWord[], char secondWord[]) {
int firstLen = strlen(firstWord), secondLen = strlen(secondWord);
return hasDistinctLetters(firstWord, firstLen) && (firstLen > secondLen || (firstLen == secondLen && strcmp(firstWord, secondWord) < 0));
}
bool isLetter(char c) {
return ('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z');
}
void distinctLettersLargestWord(char absurdWord[], char text[]) {
int n = strlen(text);
char currentWord[MAX_SIZE + 1] = {0};
bool wasWord = false;
for (int i = 0; i <= n; ++i) {
if (isLetter(text[i])) {
char letter[] = {text[i], 0};
strcat(currentWord, letter);
wasWord = true;
} else if (wasWord) {
if (moreAbsurd(currentWord, absurdWord)) {
strcpy(absurdWord, currentWord);
}
currentWord[0] = 0;
wasWord = false;
}
}
}
int main() {
char text[MAX_SIZE + 1], absurdWord[MAX_SIZE + 1] = {0};
while (cin.getline(text, MAX_SIZE + 1)) {
distinctLettersLargestWord(absurdWord, text);
}
if (absurdWord[0]) {
cout << absurdWord;
} else {
cout << "Ist nicht vorhanden!";
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0cmluZz4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmNvbnN0IGludCBNQVhfU0laRSA9IDIwMDA7Cgpib29sIGhhc0Rpc3RpbmN0TGV0dGVycyhjaGFyIHdvcmRbXSwgaW50IGxlbikgewogICAgY29uc3QgaW50IExBU1RfTEVUVEVSID0gJ3onOwogICAgaW50IGZyW0xBU1RfTEVUVEVSXSA9IHswfTsKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbGVuOyArK2kpIHsKICAgICAgICArK2ZyW3dvcmRbaV1dOwogICAgICAgIGlmIChm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VudFdvcmQsIGFic3VyZFdvcmQpKSB7CiAgICAgICAgICAgICAgICBzdHJjcHkoYWJzdXJkV29yZCwgY3VycmVudFdvcmQpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGN1cnJlbnRXb3JkWzBdID0gMDsKICAgICAgICAgICAgd2FzV29yZCA9IGZhbHNlOwogICAgICAgIH0KICAgIH0KfQoKaW50IG1haW4oKSB7CiAgICBjaGFyIHRleHRbTUFYX1NJWkUgKyAxXSwgYWJzdXJkV29yZFtNQVhfU0laRSArIDFdID0gezB9OwogICAgd2hpbGUgKGNpbi5nZXRsaW5lKHRleHQsIE1BWF9TSVpFICsgMSkpIHsKICAgICAgICBkaXN0aW5jdExldHRlcnNMYXJnZXN0V29yZChhYnN1cmRXb3JkLCB0ZXh0KTsKICAgIH0KICAgIGlmIChhYnN1cmRXb3JkWzBdKSB7CiAgICAgICAgY291dCA8PCBhYnN1cmRXb3JkOwogICAgfSBlbHNlIHsKICAgICAgICBjb3V0IDw8ICJJc3QgbmljaHQgdm9yaGFuZGVuISI7CiAgICB9CiAgICByZXR1cm4gMDsKfQ==