Iterate through the stack Use string ( int , char ) in order to replicate the character multiple times and convert into string then add in front of output string
while ( ! stk . empty ( ) ) { output += stk . top ( ) . first ; stk . pop ( ) ; } reverse ( output . begin ( ) , output . end ( ) ) ; return output ; } } ;