eolymp
bolt
Try our new interface for solving problems

Number

You are given a sequence consisting of eight digits. Each of the digits is either \textbf{1}, \textbf{2} or \textbf{3}. We select four of the given eight digits, write these digits in the order they are presented in the sequence and obtain a four-digit decimal number. Your task is to select four digits in such a way that this number is as small as possible. \InputFile The first line of input contains eight digits. Each of them is either \textbf{1}, \textbf{2} or \textbf{3}. There are no spaces between consecutive digits. \OutputFile On the first line of output, print the four-digit decimal number obtained by the above procedure. The number must be minimal possible.
Zaman məhdudiyyəti 0.1 saniyə
Yaddaşı istafadə məhdudiyyəti 256 MiB
Giriş verilənləri #1
12333333
Çıxış verilənləri #1
1233
Mənbə Yandex.Algorithm, Test Round, 27/06/2013