You are given an encoded string and an index K. The given string is read character-wise and is being written on a tape. If the character is a letter then it is written as it is. If the character is a digit(say d) then the whole tape upto its current form is written again (d-1) number of times. You have to return the Kth character of the decoded string. Example If the encoded string is : a3bc3xy and K is 14 The decoded string is formed in the manner : a-->aaa-->aaabc-->aaabcaaabcaaabc-->aaabcaaabcaaabcxy 14th character of the decoded string is 'c'
Input Format
A String
Output Format
A character
Constraints
1 <= size of the string < 1000
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
a3bc3xy 14
Output
b