2018 US group comments spring C ++ exam programming questions-digital characters, 2018 US dollars

Source: Internet
Author: User

2018 US group comments spring C ++ exam programming questions-digital characters, 2018 US dollars

Comments from the US Mission: 2018 online examination for the development direction of the spring recruitment background

Programming question | 30.0 points 2/2

Numeric characters

Time limit:The C/C ++ language is 2000 MS; other languages are 4000 MS.
Memory limit:C/C ++ language 65536KB; other languages 589213kb

Description:

In decimal notation, any positive integer can be expressed with the character '0'-'9. However, when the number of each character of '0'-'9' is limited, some positive integers may not be expressed. For example, if you have two '1' and one '2', you can represent 11,12, 121, and so on, but not 10,122,200.

Now you have some characters in your hand. They are all '0'-'9' characters. You can select some of the characters and combine them into a number. What is the smallest positive integer you cannot constitute?

Input

The first line contains a string consisting of '0'-'9', indicating the characters you can use.

· 1 ≤ string length ≤ 1000.

Output

Output the smallest positive integer that you cannot form.

?

Sample Input

55

Sample output

1

?

Hint

Input Sample 2

123456789

Output Sample 2

10

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.