#include <iostream>
#include <cstring>
using namespace std;
const int MAX_SIZE = 100;
void copySmaller(char lexicoSmall[], char text[]) {
int smallerLen = strlen(lexicoSmall);
if (smallerLen == 0 || smallerLen > strlen(text)) {
strcpy(lexicoSmall, text);
}
}
bool haveDistinctLetters(char text[]) {
const int MAX_SIZE = (int)'z';
int textLen = strlen(text), fr[MAX_SIZE + 1] = {0};
for (int i = 0; i < textLen; ++i) {
++fr[(int)text[i]];
if (fr[(int)text[i]] > 1) {
return false;
}
}
return true;
}
void findLargerDistinct(char lexicoLarge[], char text[]) {
int largeLen = strlen(lexicoLarge);
if (haveDistinctLetters(text) && (largeLen == 0 || largeLen < strlen(text))) {
strcpy(lexicoLarge, text);
}
}
int main() {
char text[MAX_SIZE + 1], lexicoSmall[MAX_SIZE + 1] = "", lexicoLarge[MAX_SIZE + 1] = "";
while (cin >> text) {
copySmaller(lexicoSmall, text);
findLargerDistinct(lexicoLarge, text);
}
if (strlen(lexicoLarge)) {
cout << lexicoLarge;
} else {
cout << lexicoSmall;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0cmluZz4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmNvbnN0IGludCBNQVhfU0laRSA9IDEwMDsKCnZvaWQgY29weVNtYWxsZXIoY2hhciBsZXhpY29TbWFsbFtdLCBjaGFyIHRleHRbXSkgewogICAgaW50IHNtYWxsZXJMZW4gPSBzdHJsZW4obGV4aWNvU21hbGwpOwogICAgaWYgKHNtYWxsZXJMZW4gPT0gMCB8fCBzbWFsbGVyTGVuID4gc3RybGVuKHRleHQpKSB7CiAgICAgICAgc3RyY3B5KGxleGljb1NtYWxsLCB0ZXh0KTsKICAgIH0KfQoKYm9vbCBoYXZlRGlzdGluY3RMZXR0ZXJzKGNoYXIgdGV4dFtdKSB7Cgljb25zdCBpbnQgTUFYX1NJWkUgPSAoaW50KSd6JzsKCWludCB0ZXh0TGVuID0gc3RybGVuKHRleHQpLCBmcltN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