#include <iostream>
#include <cstring>
using namespace std;
const int MAX_SIZE = 2000;
const int LAST_LETTER = 'z';
bool isLetter(char c) {
return ('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z');
}
void addWords(char words[][MAX_SIZE + 1], char text[], int &lastPos) {
int length = strlen(text);
bool wasLetter = false;
for (int i = 0; i <= length; ++i) {
if (isLetter(text[i])) {
char c[] = {text[i], 0};
wasLetter = true;
strcat(words[lastPos], c);
} else if (wasLetter) {
++lastPos;
wasLetter = false;
}
}
}
void interchangeSeq(char firstWord[], char secondWord[]) {
char aux[MAX_SIZE + 1];
strcpy(aux, firstWord);
strcpy(firstWord, secondWord);
strcpy(secondWord, aux);
}
void sortWords(char words[][MAX_SIZE + 1]) {
for (int i = 0; words[i][0]; ++i) {
for (int j = i + 1; words[j][0]; ++j) {
if (strcmp(words[i], words[j]) > 0) {
interchangeSeq(words[i], words[j]);
}
}
}
}
char* greatestWord(char words[][MAX_SIZE + 1]) {
for (int i = 0; words[i][0]; ++i) {
int fr[LAST_LETTER + 1] = {0};
int n = strlen(words[i]);
for (int j = 0; j <= n; ++j) {
++fr[words[i][j]];
if (fr[words[i][j]] > 1) {
break;
} else if (words[i][j] == 0) {
return words[i];
}
}
}
char text[] = "Ist nicht vorhanden!";
char* ptr = text;
return ptr;
}
int main() {
char text[MAX_SIZE + 1], words[MAX_SIZE + 1][MAX_SIZE + 1] = {0};
int lastPos = 0;
while (cin.getline(text, MAX_SIZE + 1)) {
addWords(words, text, lastPos);
}
sortWords(words);
cout << greatestWord(words);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0cmluZz4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmNvbnN0IGludCBNQVhfU0laRSA9IDIwMDA7CmNvbnN0IGludCBMQVNUX0xFVFRFUiA9ICd6JzsKCmJvb2wgaXNMZXR0ZXIoY2hhciBjKSB7CiAgICByZXR1cm4gKCdBJyA8PSBjICYmIGMgPD0gJ1onKSB8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