PivotOJ

Pea Pattern

시간 제한: 1000ms메모리 제한: 1024MB출처: ICPC ECNA 2022-2023BOJ 27615

문제

Do you see the pattern in the following sequence of numbers?

1,11,21,1112,3112,211213,312213,1, 11, 21, 1112, 3112, 211213, 312213, \ldots

Each term describes the makeup of the previous term in the list. For example, the term 31123112 indicates that the previous term consisted of three 11's (that's the 3131 in 31123112) and one 22 (that's the 1212 in 31123112). The next term after 31123112 indicates that it contains two 11's, one 22 and one 33. This is an example of a pea pattern.

A pea pattern can start with any number. For example, if we start with the number 2090220902 the sequence would proceed 202219202219, 1011321910113219, 10411213191041121319, and so on. Note that digits with no occurrences in the previous number are skipped in the next element of the sequence.

We know what you're thinking. You're wondering if 101011213141516171829101011213141516171829 appears in the sequence starting with 2090220902. Well, this is your lucky day because you're about to find out.

입력

Input consists of a single line containing two positive integers nn and mm, where nn is the starting value for the sequence and mm is a target value. Both values will lie between 00 and 10100110^{100}-1.

출력

If mm appears in the pea pattern that starts with nn, display its position in the list, where the initial value is in position 11. If mm does not appear in the sequence, display Does not appear. We believe that all of these patterns converge on a repeating sequence within 100100 numbers, but if you find a sequence with more than 100100 numbers in it, display I'm bored.

예제

예제 1

입력
1 3112
출력
5

예제 2

입력
1 3113
출력
Does not appear

예제 3

입력
20902 101011213141516171829
출력
10
코드를 제출하려면 로그인하세요.