#include <iostream>
using namespace std;
bool isValidWord(const string& word) {
int frqLetters['z' + 1] = {0};
const int lenWord = (int)word.size();
for (int i = 0; i < lenWord; ++i) {
++frqLetters[(int)word[i]];
if (frqLetters[(int)word[i]] > 1) {
return false;
}
}
return true;
}
int main() {
string text, longestWord;
while (getline(cin, text)) {
string currWord;
const int lenText = (int)text.size();
for (int i = 0; i <= lenText; ++i) {
if (isalpha(text[i])) {
currWord += text[i];
} else if (!currWord.empty()) {
if ((isValidWord(currWord) && (int)currWord.size() > (int)longestWord.size()) ||
((int)currWord.size() == (int)longestWord.size() && currWord < longestWord)) {
longestWord = currWord;
}
currWord.clear();
}
}
}
if (longestWord.empty()) {
cout << "Ist nicht vorhanden!";
} else {
cout << longestWord;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKYm9vbCBpc1ZhbGlkV29yZChjb25zdCBzdHJpbmcmIHdvcmQpIHsKICAgIGludCBmcnFMZXR0ZXJzWyd6JyArIDFdID0gezB9OwogICAgY29uc3QgaW50IGxlbldvcmQgPSAoaW50KXdvcmQuc2l6ZSgpOwogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBsZW5Xb3JkOyArK2kpIHsKICAgICAgICArK2ZycUxldHRlcnNbKGludCl3b3JkW2ldXTsKICAgICAgICBpZiAoZnJxTGV0dGVyc1soaW50KXdvcmRbaV1dID4gMSkgewogICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgfQogICAgfQogICAgcmV0dXJuIHRydWU7Cn0KCmludCBtYWluKCkgewogICAgc3RyaW5nIHRleHQsIGxvbmdlc3RXb3JkOwogICAgd2hpbGUgKGdldGxpbmUoY2luLCB0ZXh0KSkgewogICAgICAgIHN0cmluZyBjdXJyV29yZDsKICAgICAgICBjb25zdCBpbnQgbGVuVGV4dCA9IChpbnQpdGV4dC5zaXplKCk7CiAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPD0gbGVuVGV4dDsgKytpKSB7CiAgICAgICAgICAgIGlmIChpc2FscGhhKHRleHRbaV0pKSB7CiAgICAgICAgICAgICAgICBjdXJyV29yZCArPSB0ZXh0W2ldOwogICAgICAgICAgICB9IGVsc2UgaWYgKCFjdXJyV29yZC5lbXB0eSgpKSB7CiAgICAgICAgICAgICAgICBpZiAoKGlzVmFsaWRXb3JkKGN1cnJXb3JkKSAmJiAoaW50KWN1cnJXb3JkLnNpemUoKSA+IChpbnQpbG9uZ2VzdFdvcmQuc2l6ZSgpKSB8fAogICAgICAgICAgICAgICAgICAgICgoaW50KWN1cnJXb3JkLnNpemUoKSA9PSAoaW50KWxvbmdlc3RXb3JkLnNpemUoKSAmJiBjdXJyV29yZCA8IGxvbmdlc3RXb3JkKSkgewogICAgICAgICAgICAgICAgICAgIGxvbmdlc3RXb3JkID0gY3VycldvcmQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBjdXJyV29yZC5jbGVhcigpOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQogICAgaWYgKGxvbmdlc3RXb3JkLmVtcHR5KCkpIHsKICAgICAgICBjb3V0IDw8ICJJc3QgbmljaHQgdm9yaGFuZGVuISI7CiAgICB9IGVsc2UgewogICAgICAgIGNvdXQgPDwgbG9uZ2VzdFdvcmQ7CiAgICB9CiAgICByZXR1cm4gMDsKfQoK