At end if the list is empty it means the string is perfectly nested
if ( lst . length == 0 && c == 0 ) { document . write ( 0 + " " ) ; b = 1 ; } if ( a == 0 && b == 0 && c == 0 ) { document . write ( k + " " ) ; } }