The way we go about solving this is to read the string character by character and perform
an operation based on the character. It is a state machine where the state may change based on
whatever the current input character is. Important transitions happen when characters like '[', ']',
',' are seen. We use a stack to keep track of the parent at any point of time.
The solution can be found at: