x=input() t=sorted(x,reverse=True) t[-1],t[-2]=t[-2],t[-1] if t!=x: print(''.join(t)) else: print('-1')