X = sorted(input(),reverse = True) for i in range(len(X)-1, 1, -1): if X[i] != X[i-1]: X[i],X[i-1] = X[i-1],X[i] print(''.join(X)) exit() print(-1)