#GYM104614G. Pea Pattern
Pea Pattern
Description
Do you see the pattern in the following sequence of numbers?
A pea pattern can start with any number. For example, if we start with the number $20902$ the sequence would proceed $202219$, $10113219$, $1041121319$, 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 $101011213141516171829$ appears in the sequence starting with $20902$. Well, this is your lucky day because you're about to find out.
Input consists of a single line containing two positive integers $n$ and $m$, where $n$ is the starting value for the sequence and $m$ is a target value. Both values will lie between $0$ and $10^{100}-1$.
If $m$ appears in the pea pattern that starts with $n$, display its position in the list, where the initial value is in position $1$. If $m$ does not appear in the sequence, display Does not appear. We believe that all of these patterns converge on a repeating sequence within $100$ numbers, but if you find a sequence with more than $100$ numbers in it, display I'm bored.
Input
Input consists of a single line containing two positive integers $n$ and $m$, where $n$ is the starting value for the sequence and $m$ is a target value. Both values will lie between $0$ and $10^{100}-1$.
Output
If $m$ appears in the pea pattern that starts with $n$, display its position in the list, where the initial value is in position $1$. If $m$ does not appear in the sequence, display Does not appear. We believe that all of these patterns converge on a repeating sequence within $100$ numbers, but if you find a sequence with more than $100$ numbers in it, display I'm bored.
1 3112
1 3113
20902 101011213141516171829
5
Does not appear
10