#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  string S;
  cin>>S;
  map<char, int> amap;
  for(int i=0;i<S.size();++i) {
    amap[S[i]]++;
  }
  if(S.size()<26) {
    for(char i='a';i<='z';++i) {
      if(amap[i]==0) {
        S.push_back(i);
        break;
      }
    }
    cout<<S<<endl;
    return 0;
  }
  else {
    int num;
    bool can = false;
    vector<char> arr;
    arr.push_back(S[S.size()-1]);
    for(int i=S.size()-2;i>=0;--i) {
      for(int j=0;j<arr.size();++j) {
        if(S[i]<arr[j]) {
          can = true;
          num = S.size()-i;
          S[i] = arr[j];
          break;
        }
      }
      if(can) break;
      arr.push_back(S[i]);
      sort(arr.begin(), arr.end());
    }
    if(!can) {
      cout<<-1<<endl;
      return 0;
    }
    for(int i=0;i<num-1;++i) S.pop_back();
    cout<<S<<endl;
    return 0;
  }
}


#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;


template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

// 繰り返し二乗法
ll pow2(ll n, ll p, ll mod) {
	if (p == 0 || n == 1) {
		return 1;
	}
	else {
		ll ret = pow2(n * n % mod, p / 2, mod);
		if (p % 2 == 1) {
			ret *= n;
		}
		return ret % mod;
	}
}


#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)

int main() {
	string S;
	cin >> S;

	vector<set<char>> vs(S.size()+1);
	rep(i, 0, S.size()) {
		vs[i + 1] = vs[i];
		vs[i+1].insert(S[i]);
	}

	char next = 'a'-1;
	for (ll i = S.size(); i >=0; i--) {
		for (char c = next+1; c <= 'z'; c++) {
			if (vs[i].find(c) == vs[i].end()) {
				cout << S.substr(0,i) << c << endl;
				return 0;
			}
		}
		next = S[i - 1];
	}

	cout << -1 << endl;
	return 0;

}
