X = list(input()) if len(set(X)) == 1: print(-1) exit() X.sort() for i in range(len(X)-1): if X[i] == X[i+1]: continue if i+1 < len(X)-1: X[i],X[i+1] = X[i+1],X[i] print("".join(X[::-1])) exit() print(-1)