시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 512 MB 10 7 7 70.000%

문제

The technology behind the fridge has changed little over the years. Even so, many of the original owners of the Fred W. Wolf domestic refrigerator of 1913 would be amazed by the size and features of the modern appliances. However, since the 1960s one thing has been common for all fridge owners around the world: fridge magnets.

An effective, albeit lazy, way to keep a small child entertained is to supply them with a set of magnetic numbers and a large magnetic surface, such as said fridge, to provide the playing field upon which to apply these digits.

Far from a time-wasting exercise, this provides valuable training in the mathematical field of counting: moving the digits around to form “1”, “2”, and so on up to such heights as “10”, “11”, “12”, and even beyond.

The possibilities are endless! ...Or at least, they would be, if the supply of digits was not limited. Given the full list of what numbers we are in possession of, what is the smallest positive number that cannot be made using each of digits at most once?

입력

  • One string of at most 1000 digits, containing the available digits in no particular order.

출력

  • One line containing one positive integer: the smallest natural number that it is not possible to assemble from the supplied digits.

예제 입력 1

7129045863

예제 출력 1

11

예제 입력 2

55

예제 출력 2

1

예제 입력 3

123456789

예제 출력 3

10