Nth character in Decrypted String
Every character in the input string is followed by its frequency.
Write a function to decrypt the string and find the nth character of the
decrypted string. If no character exists at that position then return "-1".
For eg:- if the input string is "a2b3" the decrypted string is "aabbb".
Note: The frequency of encrypted string cannot be greater than a single
digit i.e < 10.
Input Specification:
input1: a string
input2: n, the position of the character starting from 1
Answers
Answered by
0
Answer:
it is not computer science questions
Explanation:
I don't know
this question answer
Answered by
0
Answer:
written below-
Explanation:
Given an encoded string you need find the encrypted string and then find the nth character from the encrypted string where repetitions of substrings are represented as substring followed by count of substrings.
For example, if encrypted string is “ab2cd2” and n=4 , so output will be ‘b’ because decrypted string is “ababcdcd” and 4th character is ‘b’.
Note: 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 frequency of substring.
#SPJ3
Similar questions