As we encounter closing braces we map them with theircorresponding opening braces using dictionary and check if it is same as last opened braces ( last element in list ) if yes then we delete that elememt from list
if ( Dict [ string [ i ] ] == lst [ lst . length - 1 ] ) { lst . pop ( ) ; } else {