pop characters till 0 - th index
while ( idx >= 0 ) { if ( st . size ( ) == 0 ) { return false ; } char c = st . peek ( ) ; st . pop ( ) ; if ( c != S2 . charAt ( idx ) ) { return false ; } idx -- ; } } }