eolymp
bolt
Try our new interface for solving problems
Problems

The Bank Cards

The Bank Cards

The bank "Kislovodsk" decided to introduce a new kind of bank cards. To do it, the identical blank cards were produced, that contains the special place for customer identification. Initially the code number \textbf{X} is written here. The bank has a special device that allows to erase some digits of \textbf{X}. The remaining numbers being recorded in a row, form a customer's account number. For example, if \textbf{X = 12013456789}, the account numbers \textbf{5}, \textbf{12}, \textbf{17} or \textbf{12013456789} can be obtained, but the numbers \textbf{22} or \textbf{71} impossible to obtain. The distribution of account numbers in a bank is very simple. The accounts are assigned sequentially the numbers \textbf{1}, \textbf{2}, … Obviously, at some moment of the time there will appear the account number \textbf{N }that cannot be obtained from the digits of \textbf{X} with a way described above. The bank management wants to know the value of \textbf{N}. Write a program that finds the value of \textbf{N} if \textbf{X} is given. \InputFile The positive integer \textbf{X} (\textbf{1} ≤ \textbf{X} < \textbf{10^1000}) without leading zeroes. \OutputFile Print number \textbf{N} without leading zeroes.
Time limit 1 second
Memory limit 64 MiB
Input example #1
239
Output example #1
1