|分隔符左边的数字表示分隔符右边的字符出现多少次
然后需要实现去除 [ ] | 的这么一个算法
例如输入HG[3|B[2|CA]]F
输出HGBCACABCACABCACAF
说明HG[3|B[2|CA]]F -> HG[3|BCACA]F -> HGBCACABCACABCACAF
代码如下
import sys
str = sys.stdin.readline().strip()
while len(str)>0:
for i in range(len(str)):
ifs = False
temp = ''
if str[i] == ']':
count = i - 1
while str[count] != '[':
temp = temp + str[count]
count = count - 1
new = ''
for i in temp:
new = i+new
temp = new
'''
字符串的反转
temp = temp[::-1]
'''
'''
字符串的反转
arrrr = list(temp)
arrrr.reverse()