while 1:exec"print max({'%s'})"%"'}^{'".join(raw_input())