#include<bits/stdc++.h>
using namespace std;
int ct[100];
int main(){
 string st;
cin >> st;
for (int i = 0; i < (int)st.size(); i++)
ct[st[i] - 'a'] = 1;
bool flag = 1;
int offBit = -1;
for (int i = 0; i < 26; i++) if (!ct[i]){
flag = 0;
offBit = i;
break;
}
if (!flag){
cout << st << char(offBit + 'a'); exit(0);
}
string tmp = st;
if (next_permutation(tmp.begin(), tmp.end()) ){
for (int i = 0; i < (int)tmp.size(); i++)
if (tmp[i] == st[i]) cout << st[i];
else  { cout << tmp[i]; exit(0);}
}
else cout << -1;
}