// Slower C++ solution:
#include <iostream>

#include <vector>

#include <algorithm>

#include <string>

#include <map>

#include <cmath>

#include <queue>

#include <numeric>

#include <climits>

#include <iterator>

#include <iomanip>

#include <stack>

#include <bitset>

#include <functional>

using namespace std;

const constexpr int INF = 1e9;

//typedef std::pair<std::string,double> P;

 

 

typedef long long ll;

typedef vector<int> VI;

    

vector<pair<int, int> > vp;

 

struct Less {

    bool operator()(const pair<int, int>& x, const pair<int, int>& y) const {

        return x.first > y.first;

    }

};

#define FOR(i, a, n) for (ll i = (ll)a; i<(ll)n; ++i)

#define REP(i, n) FOR(i, 0, n)

 

//グラフの隣接リスト

VI g[200010];

//頂点の入次数を管理

int h[100010];

ll N, K;

string s;

int arr[26];

int main(void) {

    cin >> s;

    for(int i=0; i<s.size(); ++i){

        arr[(s[i]-'a')]++;

    }

    if(s=="zyxwvutsrqponmlkjihgfedcba"){

        cout << -1 << endl;

        return 0;

    }

    if(s.size()<=25){

        cout << s;

        for(int i=0; i<26; ++i){

            if(arr[i]!=1) {

                cout << (char)('a'+i) << endl;

                break;

            }

        }

    }else{

        vector<char> can;

        int i=25;

        can.push_back(s[s.size()-1]);

        while(s[i-1]>s[i]){

            i--;

            can.push_back(s[i]);

        }

        i--;

        sort(can.begin(), can.end());

        for(int l=0; l<can.size(); ++l){

            if(s[i]<can[l]){

                cout << s.substr(0, i) << can[l] << endl;

                return 0;

            }

        }

        

    }

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 6.44595738167812x):
#include <iostream>

#include <vector>

#include <algorithm>

#include <string>

#include <map>

#include <cmath>

#include <queue>

#include <numeric>

#include <climits>

#include <iterator>

#include <iomanip>

#include <stack>

#include <set>

#include <cstdio>

#include <bitset>

#include <functional>

#include <tuple>

#include <list>

#include <deque>

#include <sstream>

using namespace std;

const constexpr int INF = 1e9;

#define FOR(i, a, n) for (ll i = (ll)a; i<(ll)n; ++i)

#define REP(i, n) FOR(i, 0, n)



typedef long long ll;

typedef vector<int> VI;

const constexpr ll MOD = 1e9+7;

struct Less{

   bool operator()(const pair<string, int>&a, const pair<string, int>&b){

        if(a.first==b.first){

            return a.second < b.second;

        }

       return a.first < b.first;

    }

};



ll extGCD(ll a, ll b, ll& x, ll& y){

    if(b==0){

        x=1;

        y=0;

        return a;

    }

    ll d = extGCD(b, a%b, y, x);

    y -= a/b*x;

    return d;

}

ll GCD(ll a, ll b){

    if(a<b) swap(a, b);

    if(b==0) return a;

    return GCD(b, a%b);

}

int par[100010], rr[100010];

void init(){

    for(int i=0; i<100010; ++i){

        par[i]=i;

        rr[i]=0;

    }

}

int root(int x){

    return par[x] == x ? x:par[x] = root(par[x]);

}

bool same(int x, int y){

    return root(x)==root(y);

}

void unite(int x, int y){

    x = root(x);

    y = root(y);

    if(x==y) return ;

    

    if(rr[x]<rr[y]){

        par[x] = y;

    }else{

        par[y] = x;

        if(rr[x]==rr[y]) rr[x]++;

    }

}



ll pow_mod(ll x, ll n){

    ll res = 1;

    while(n>0){

        if(n&1){

            res = res*x%MOD;

        }

        x = x*x%MOD;

        n>>=1;

    }

    return res;

}

int alph[26];

int main() {

    string S; cin >> S;

    if(S=="zyxwvutsrqponmlkjihgfedcba"){

        cout << -1 << endl;

        return 0;

    }

    if(S.size()<26){

        for(int i=0; i<S.size(); ++i){

            alph[S[i]-'a']++;

        }

        cout << S;

        for(int i=0; i<26; ++i){

            if(alph[i]==0){

                cout << (char)(i+'a') << endl;

                break;

            }

        }

        cout << endl;

    }else{

        vector<string> v;

        for(int i=S.size()-1; i>=0; i--){

            for(int j=i-1; j>=0; j--){

                if(S[i]>S[j]){

                    string s="";

                    for(int k=0; k<j; ++k){

                        s+=S[k];

                    }

                    s+=S[i];

                    v.push_back(s);

                    break;

                }

            }

        }

        v.push_back(S);

        sort(v.begin(), v.end());

        for(int i=0; i<v.size(); ++i){

            if(v[i]==S) cout << v[i+1] << endl;

        }

        

    }

    return 0;

}