//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    string s,ans;cin>>s;
    if(s.size()!=26){
        vector<int> vec(26);
        for(char c:s){
            vec[(c-'a')]++;
        }
        for(int i=0;i<26;i++){
            if(vec[i]==0){
                ans=s+(char)('a'+i);
                break;
            }
        }
    }
    else{
        bool answer=false;
        vector<int> vec(26);
        for(int i=25;i>=0;i--){
            int tmp=s[i]-'a';
            vec[tmp]++;
            for(int j=tmp+1;j<26;j++){
                if(vec[j]){
                    ans=s.substr(0,i)+(char)('a'+j);
                    answer=true;
                    break;
                }
            }
            if(answer)break;
        }
        if(!answer)ans="-1";
    }
    cout<<ans<<endl;
}

#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const int INF=1e9;
const ll MX = 1e18;
const ll MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
const string tr="abcdefghijklmnopqrstuvwxyz";
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define YN {puts("YES");}else{puts("NO");}
const ll MAX = 1000001;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {fac[0] = fac[1] = 1;finv[0] = finv[1] = 1;inv[1] = 1;for (ll i = 2; i < MAX; i++){fac[i] = fac[i - 1] * i % MOD;inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;finv[i] = finv[i - 1] * inv[i] % MOD;}}
long long COM(ll n, ll k){if (n < k) return 0;if (n < 0 || k < 0) return 0;return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;}
ll llpow(ll n,ll i){ll cnt=n;  for(ll j=0;j<i-1;j++){n*=cnt;}return n;}

int main(){
  string s;
  cin>>s;
  int n=len(s);
  vi T(26);
  string t=tr;
  rep(i,n){
    rep(j,26){
      if(s[i]==t[j]){
        T[j]++;
      }
    }
  }
  if(n<26){
    rep(i,26){
      if(T[i]==0){
        s+=t[i];
        break;
      }
    }
    cout<<s<<endl;
    return 0;
  }
  if(n==26){
    vector<char> vec;
    for (int i = 0; i < s.size(); ++i) {
    vec.push_back(s[i]);
    }
    if (next_permutation(s.begin(), s.end())) {
                string res = "";
                for (int i = 0; i < s.size(); ++i) {
                    res += s[i];
                    if (vec[i] != s[i]) break;
                }
                cout << res << endl;
            }
            else {
                cout << -1 << endl;
            }
  }
}