If closing bracket ' ] ' , pop elemment until ' [ ' opening bracket is not found in the character stack .
else if ( str . charAt ( i ) == ' ] ' ) { temp = " " ; count = 0 ; if ( ! integerstack . isEmpty ( ) ) { count = integerstack . peek ( ) ; integerstack . pop ( ) ; } while ( ! stringstack . isEmpty ( ) && stringstack . peek ( ) != ' [ ' ) { temp = stringstack . peek ( ) + temp ; stringstack . pop ( ) ; } if ( ! stringstack . empty ( ) && stringstack . peek ( ) == ' [ ' ) stringstack . pop ( ) ;