An encoded string
s is given. To find and write the decoded string to a tape, the encoded string is read one character at a time and the following steps are taken:
d), the entire current tape is repeatedly written
d-1more times in total.
Now for some encoded string
s, and an index
k, find and return the
k-th letter (1 indexed) in the decoded string.
Input: s = "leet2code3", k = 10 Output: "o" Explanation: The decoded string is "leetleetcodeleetleetcodeleetleetcode". The 10th letter in the string is "o".
Input: s = "ha22", k = 5 Output: "h" Explanation: The decoded string is "hahahaha". The 5th letter is "h".
Input: s = "a2345678999999999999999", k = 1 Output: "a" Explanation: The decoded string is "a" repeated 8301530446056247680 times. The 1st letter is "a".
2 <= s.length <= 100
swill only contain lowercase letters and digits
sstarts with a letter.
1 <= k <= 109
kis less than or equal to the length of the decoded string.