def split(str):
sps = []
tk = ""
ot = 0
for i in str:
tk = tk + i
if i == "(" or i == "[":
ot = ot + 1
if i == ")" or i == "]":
ot = ot - 1
if ot == 0 and tk != "":
sps.append(tk)
tk = ""
return sps
vp = input("введите варежки и перчатки:")
rez = split(vp)
print("результат:", rez)