Question: Simple decryption Problem Statement You come across a dump of secrets that have a very simple eneryption. Each secret is a simple string that contains
Simple decryption
Problem Statement
You come across a dump of secrets that have a very simple eneryption. Each secret is a simple string that contains combination of or less than unique letters from a to without any spaces or special characters.
The encryption scheme is as follows:
In the final encrypted string, each unique letter appears only once, For each subsequent appearance of the letter, it is denoted by the letter's index in the list of unique letters in the string, ordered by its first appearance.
For example if the secret string is doctorstrange, the encrypted string will be doctrsange
For a given encrypted string str you need to crack the code and figure out the original unencrypted string.
Input Format
Input contains a single string str
Constraints
lengthstr
Total number of unique characters in str will be
Output Format
A single string which is the unencrypted version of encrypted string str If the encrypted string is invalid, ie it cannot be a valid encrypted string as per the above encryption schema, the output should be "invalid code"
Sample Input:
doctrsange
Sample Output:
doctorstrange
tableLetterUntque Characters List,CharacteriDiglt,Unenerypted Stringddcharacter,dcharacter,ccharacter,ctcharacter,tdigit,character,
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
