using C=System.Console;class M{static void Main(){var a=new char[10];for(int i=0,b;(b=C.Read())>0;i*=b/97)C.Write(a[++i]=b>a[i]?(char)b:a[i]);}}