import std.algorithm;
import std.array;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

immutable int letters = 26;

string solve (string s)
{
	auto n = s.length.to !(int);
	if (n == letters)
	{
		auto t = s.dup;
		if (nextPermutation (t.representation))
		{
			auto r = t.idup;
			while (s < r[0..$ - 1])
			{
				r = r[0..$ - 1];
			}
			return r;
		}
		return "-1";
	}
	else
	{
		foreach (c; 'a'..'z' + 1)
		{
			if (!s.canFind (c))
			{
				return s ~ c.to !(char);
			}
		}
		assert (false);
	}
}

void main ()
{
	string s;
	while ((s = readln.strip) != "")
	{
		writeln (solve (s));
	}
}
