Iterating till the entire Digit is read
st = " " NEW_LINE while s [ i ] . isdigit ( ) : NEW_LINE INDENT st += s [ i ] NEW_LINE i = i + 1 NEW_LINE DEDENT k . append ( int ( st ) ) NEW_LINE depth , flag = 0 , 1 NEW_LINE open , close = 0 , 0 NEW_LINE for i in k : NEW_LINE