private static string lexistring(string S, int k)
int originallength = S.Length;
foreach (char i in S.ToCharArray())
while (lexianswer.Length > 0 && lexianswer[lexianswer.Length - 1] > i && k > 0)
lexianswer = lexianswer.Substring(0, lexianswer.Length - 1);
if(lexianswer.Length==originallength)
lexianswer = lexianswer.Substring(0, lexianswer.Length - 1);
public static void Main(String[] args)
string name = Console.ReadLine();
Console.WriteLine(lexistring(name,1));