#include <bits/stdc++.h>

using namespace std;

int main(){
	string s, t;
	cin >> s;
	t = s;
	if(s.size() < 26){
		map <int, int> used;
		for(auto u : s) used[u] = 1;
		char f;
		for(int i = 'a'; i <= 'z'; ++i){
			if(!used[i]){
				f = i;
				break;
			}
		}
		cout << s << f << endl;
		return 0;
	}
	bool f = next_permutation(s.begin(), s.end());
	if(f == false){
		cout << -1 << endl;
	}
	else{
		for(int i = 0; i < s.size(); ++i){
			cout << s[i];
			if(s[i] != t[i]) break;
		}
		cout << endl;
	}
	return 0;
}
