+ 2
My 3rd case of code coach TEXT DECOMPRESSOR problem is not running
Plz tell what improvement are necessary https://code.sololearn.com/c7OBAw45ek0l/?ref=app
3 Respuestas
0
You need to decompress text. The compressed version has a number next to each symbol/letter, representing the amount of time that symbol should appear.
For example, a2b3 is the compressed version of aabbb
Task:
Write a program that takes the compressed text as input and outputs the decompressed version.
Input Format:
A single string with letters/symbols, each followed by a number.
Output Format:
A string, representing the decompressed text.
Sample Input:
k2&4b1
Sample Output:
kk&&&&b
0
compressed_string = input()
decompressed_string = " "
for i in compressed_string:
if not i.isdigit():
decompressed_string += i * int(compressed_string[(compressed_string.index(i)+1)])
print(decompressed_string)
- 1
I am not a pro member so tell me the whole question so I will definitely helps u.