You have been given an Encrypted String where repetitions of substrings are represented as substring followed by the count of substrings.
Example: String "aabbbcdcdcd" will be encrypted as "a2b3cd3".
You need to find the 'K'th character of Decrypted String. Decrypted String would have 1-based indexing.
Input string will always be lowercase characters without any spaces. If the count of a substring is 1 then also it will be followed by Integer '1'. Example: "aabcdee" will be Encrypted as "a2bcd1e2" This means it's guaranteed that each substring is followed by some Integer. Also, the frequency of encrypted substring can be of more than one digit. For example, in "ab12c3", ab is repeated 12 times. No leading 0 is present in the frequency of substring. The frequency of a repeated substring can also be in parts. Example: "aaaabbbb" can also have "a2a2b3b1" as Encrypted String.
S = "a2b3cd3" Decrypted String of S = "aabbbcdcdcd" According to 1-based indexing for S, the 8th character is 'c'.
S = "ab12c3" Decrypted String of S = "ababababababababababababccc" So 20th character is 'b'.