String Word Codevita 9 Solution

String Word Codevita 9 Solution

Problem Description

A PC researcher has built up an encryption calculation. This calculation takes two sources of info – one plain word and another, a key. Qualities of data sources are as beneath. 

Plain word: It is a string comprising of lowercase letters in order as it were. 

Key: It is a lot of sets of strings comprising of lowercase letter sets as it were. For each pair, first string is the plain word and second string is its mystery word. The characters of these mystery words are confused yet lengths of Plain Word and Secret Word are equivalent. 

 

This calculation finds the mystery characters for each character in the inputted plain word by utilizing the key. At that point it consolidates all the mystery characters in a similar request to shape a string called the mystery word. At long last yield this mystery word. Beneath table shows how mystery characters can be acquired from the key. 

 

Models 

Your errand is to help him in actualizing the calculation as a PC program. 

Note: It is ensured that all characters in the given plain word can be changed over to mystery characters by utilizing the given key. 

Note: It is ensured that one plain content can be changed over to just one encoded text. 

 

Imperatives 

1 <= P <= 52000 

1 <= N <= 26 

1 <= Length of a plain word in pair <= 50000 

1 <= Length of a mystery word in pair <= 50000 

Length (plain word) == Length (mystery word) 

 

Info 

First line contains string P meaning the plain content. 

Second line contains a number N signifying number of key sets. 

Next N lines, each contain two space isolated strings meaning plain content and key. 

 

Yield 

Print the encoded word. 

Time Limit 

 

Models 

Model 1 

Info 

load 

application lol 

old tip 

odd itt 

 

Yield 

piot 

Clarification 

“load” is the plain word to be encoded. Given Key contains 3 sets of Plain word and Secret word mix. They are <“app”, “lol”>, <“old”, “tip”> and <“odd”, “itt”>. From first pair, plainly the mystery character of ‘p’ is ‘l’ and that of ‘an’ is ‘o’. From third pair, unmistakably the mystery character of ‘d’ is ‘t’ and that of ‘o’ is ‘I’. By utilizing above discoveries, from second pair, unmistakably the mystery character of ‘l’ is ‘p’. Presently we can construct the mystery word by supplanting the characters of plain word by its comparing mystery characters as “piot”. 

 

Model 2 

 

Info 

 

 

 

a b 

 

Yield 

 

 

Clarification 

 

“An” is the plain word to be changed over to mystery word. The given key comprises of just one plain word – mystery word pair. i.e., <“a”, “b”>. From this, unmistakably the mystery character of ‘an’ is ‘b’, since there is just one character in both mystery and plain words. Along these lines, the last yield is “b”.

Codevita Season 9 All Questions Solutions

Listed Here :

Leave a Comment