#include <iostream>
#include <cstring>
using namespace std;
const int MAX_SIZE = 100;
void copySmaller(char lexicoSmall[], char text[]) {
if (strlen(lexicoSmall) == 0 || strcmp(lexicoSmall, text) > 0) {
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[]) {
if (haveDistinctLetters(text) && (strlen(lexicoLarge) == 0 || strcmp(lexicoLarge, text) < 0)) {
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;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0cmluZz4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmNvbnN0IGludCBNQVhfU0laRSA9IDEwMDsKCnZvaWQgY29weVNtYWxsZXIoY2hhciBsZXhpY29TbWFsbFtdLCBjaGFyIHRleHRbXSkgewogICAgaWYgKHN0cmxlbihsZXhpY29TbWFsbCkgPT0gMCB8fCBzdHJjbXAobGV4aWNvU21hbGwsIHRleHQpID4gMCkgewogICAgICAgIHN0cmNweShsZXhpY29TbWFsbCwgdGV4dCk7CiAgICB9Cn0KCmJvb2wgaGF2ZURpc3RpbmN0TGV0dGVycyhjaGFyIHRleHRbXSkgewoJY29uc3QgaW50IE1BWF9TSVpFID0gKGludCkneic7CglpbnQgdGV4dExlbiA9IHN0cmxlbih0ZXh0KSwgZnJbTUFYX1NJWkUgKyAxXSA9IHswfTsKCWZvciAoaW50IGkgPSAwOyBpIDwgdGV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