pattern from left to right and prints onto a tape:
- a letter is appended to the end of the tape;
- a digit d turns the whole current tape into d copies of itself back to back (it appends d - 1 more copies).
The tape can get astronomically long, so printing it out is not an option. Return the k-th letter of the finished tape (1-based).pattern='ab3c2', k=8 → 'a'
The tape grows as ab → ababab → abababc → abababcabababc. The 8th letter is a.
pattern='xy2z9', k=45 → 'z'
After xy2z the tape holds xyxyz (5 letters); after 9 it holds 45. The last of them is z.
pattern='q777777', k=100000 → 'q'
The tape is all qs, 7⁶ = 117649 of them, so every letter is q.
pattern consists of lowercase English letters and digits 2 to 9 and starts with a letterk does not exceed the tape length, and the tape is shorter than 2⁶³pattern='ab3c2', k=8
'a'
Run checks the first 3 tests in your browser. Submit checks all 73 tests on the server, hidden ones included.