Appointments
InterviewTime limit2sMemory limit1024 MB
Given a string, delete every occurrence of one character so that the remaining string is lexicographically smallest, and print it.
Problem
Dr. House hates waiting. He especially hates it when his patients have to wait in the queue for surgery. Usually this is not a problem, because the hospital administration always makes room for the best doctor. But now Foreman is at a conference, and House has to take desperate measures.
The hospital recently installed a new system for registering patients for surgery. House hired a hacker who broke into it. It turned out that each surgery appointment is stored in the database as a string made of lowercase Latin letters, digits, and underscores. The hacker is not very skilled, so he can change an appointment only by deleting all occurrences of one character from it. Also, from each string in the database, occurrences of only one character can be deleted, otherwise the string is marked invalid.
Dr. House has picked the record he wants to change, and he wants to know the lexicographically smallest string that can result from it.
Input
The first line contains the surgery appointment that House wants to fix, a string () made of lowercase Latin letters, digits, and underscores.
Output
Print the lexicographically smallest string that Dr. House can obtain.