#P1511. [SDOI2006] 数字串位置 / 超长数字串

[SDOI2006] 数字串位置 / 超长数字串

Description

What he likes most is the infinite sequence of digits formed by writing all natural numbers in ascending order. This sequence begins as: 1234567891011121314...\texttt{1234567891011121314...}

We call this sequence SS, and S1=1S_1 = 1, S2=2S_2 = 2, ... , S10=1S_{10} = 1, S11=0S_{11} = 0, and so on.

George has a digit sequence AA, and he wants to know the earliest position where this sequence appears in SS. Please help him solve this problem.

Input Format

Input a single string representing the digit sequence A, with length at most 200, and no spaces.

Output Format

Output the smallest positive integer kk such that $A_1 = S_k, A_2 = S_{k+1}, ...,A_{len_{A}} = S_{k + len(A)-1}$ holds, where len_{A} denotes the length of sequence A.

101

10

Hint

Source

Ural State University Problem Archive.

Translated by ChatGPT 5