import re
def parse(tell: str) -> list:
start_number = 0
li = []
d_dic = {"i": lambda x: x + 1, "d": lambda x: x - 1, "s": lambda x: x * x}
tell = re.sub("[^idso]", "", tell)
for d in tell:
if d == "o":
li.append(start_number)
else:
start_number = d_dic[d](start_number)
return li
def parse(s: str) -> list:
result = []
initial = 0
for i in s:
if i == "i":
initial += 1
elif i == 'd':
initial -= 1
elif i == 's':
initial = pow(initial, 2)
elif i == 'o':
result.append(initial)
return result
def parse(order:str)->list:
num=0
list_num=[]
for i in order:
if i=='i':num+=1
elif i=='d':num-=1
elif i=='s':num**=2
elif i=='o':list_num.append(num)
return list_num
func Parse(data string) []int {
tmp := 0
res := make([]int, 0)
for _, i := range data {
if i == 'i' {
tmp++
} else if i == 'd' {
tmp--
} else if i == 's' {
tmp = tmp * tmp
} else if i == 'o' {
res = append(res, tmp)
}
}
return res
}