```
class Solution(object):
def deserialize(self, s):
"""
:type s: str
:rtype: NestedInteger
"""
stack = []
curlist = []
num = None
negtive = 1
for c in s:
if c.isdigit():
if num is None:
num = 0
num = num * 10 + int(c)
elif c == '-':
negtive = -1
elif c == ',':
if num is not None:
curlist.append(num*negtive)
num = None
negtive = 1
elif c == '[':
stack.append(curlist)
curlist = []
num = None
elif c == ']':
prevlist = stack.pop()
if num is not None:
curlist.append(num*negtive)
prevlist.append(curlist)
curlist = prevlist
num = None
negtive = 1
if not '[' in s:
return num * negtive
else:
return prevlist[0]
```