Computer Science, asked by montikansal6902, 7 months ago

Short Hand
Raj is a personal assistant to a CEO of a huge company. Since, the CEO has a lot of instructions, Raj notes what ever the CEO says in short hand. The way he does this is quite simple actually and is clearly shown in the sample input. Your task is to take the short hand text and convert it to its original form.
Another example is, 2a5d - adddddaddddd
Lets see if you are up to the task! Input Format : The only line of input contains a string S - the string to be decoded.
Input Constraints : 2 ≤ |S| ≤ 10
'A' ≤ s[i] ≤ 'Z', i is even
'0' ≤ s[i] ≤ '9', i is odd
Output Format : The output contains a single string - the decoded string.
Sample Input :
3a6c2d
Sample Output :
acddcddcddcddcddcddacddcddcddcddcddcddacddcddcddcddcddcdd

Answers

Answered by bhanu15v98
0

Answer:

sen = "2a5d"    

ptr = len(sen)-2    

alp = len(sen)-1  

blank = ""

while ptr>-1:

 blank = sen[alp]+blank            

 blank = int(sen[ptr])*blank        

 ptr-=2

 alp-=2

print(blank)

Explanation:

Answered by sujan3006sl
0

Answer:

Below is the Python code for the given problem statement :

(explanation is given step by step in code itself)

# Initialize the input string and the blank string

input_string = "3a6c2d"

blank_string = ""

#calculating the length of the given input string

lenght_1 = len(sen)-2    

length_2 = len(sen)-1  

#iteraating using while loop

while length_1>-1:

blank_string = input_string[lenght_2]+blank_string          

blank_string= int(input_string[length_1])*blank_string      

#Decrementing the values of variables:

length_1-=2

length_2-=2

#printing the value of blank_string:

print(blank_string)

#SPJ3

Similar questions