if character at top of stack is same as current character increase the number of repetitions in the top of stack by 1
if ( s [ i ] == ( stk . top ( ) ) . first ) { stk . push ( { s [ i ] , stk . top ( ) . second + 1 } ) ; if ( stk . top ( ) . second == k ) { int x = k ; while ( x ) { stk . pop ( ) ; x -- ; } } } else {