Mini Parser

medium
Given a string s represents the serialization of a nested list, implement a parser to deserialize it and return the deserialized NestedInteger.
Each element is either an integer or a list whose elements may also be integers or other lists.

Input Format

Input is managed for you

Output Format

Output is managed for you

Constraints

1. 1 <= s.length <= 5 * 104
2. s consists of digits, square brackets "[]", negative sign '-', and commas ','.
3. s is the serialization of valid NestedInteger.

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
[123,[456,[789]]]
Output
]
]
]
789
[
[
]
456
[
[
]
123
[
Previous
Baseball Game
Next
Binarysearchtree Iterator

Related Questions