CJCoding With Joseph
15free / daySign inCreate account

Undo History Stack

A stack<string> named history already holds three actions pushed in this order: "type a", "type b", "delete" (so "delete" is on top). Print the top action, pop it (like an undo), then print the new top action, each on its own line.

Print exactly what is shown in Expected Output.

Expected Output:

delete
type b

= newline. The output ends with a newline — print one after the last line.

Hints2 available
Topics:
STL ContainersStacks
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.