问题给出了一个‘压缩后’的文字,要求输出一个解压后的文字。
如:输入hel(-1)o,输出hello。
(-1)是指代前一位重复出现过的字母,如图所示
由于只学过入门的for循环和index的切片等操作。我尝试用i.isdigit()找到字符串里的数字,然后定位它的index,但是如果出现了一样的数字定位就会有问题
求大家帮助~谢谢
Text to decompress? hel(-1)o
hello
Text to decompress? a(-1)rdv(-4)(-4)k
aardvark
Text to decompress? The cat(-4)in(-3)(-5)(-11)(-11)(-4)(-3)(-11)(-6)
The cat in the hat