第6章-5 列表元素个数的加权和(1)
str1 = input()
str2 = str1.replace('[', '').replace(']', '')
lst = str2.split(',')
lst = [int(t) for t in lst]
res = 0
n = 0
for i in range(len(str1)):
if str1[i] == '[':
n += 1
elif str1[i] == ']':
n -= 1
elif str1[i] == ',':
continue
elif str1[i + 1] == ',' or str1[i + 1] == ']':
res += n
print(res)