CJCoding With Joseph
15free / daySign inCreate account

Pop Then Peek

A stack<int> named s already holds 1, 2, 3 (3 is on top). Remove the top element with pop(), then print the new top element and the number of elements left, each on its own line.

Print exactly what is shown in Expected Output.

Expected Output:

Top: 2
Size: 2

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

Hints3 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.