#include <iostream>
#include <stack>
int main() {
std::stack<int> myStack;
// A) Add at least 10 elements into the stack
for (int i = 1; i <= 10; ++i) {
myStack.push(i);
}
// B) Remove an element from the stack
if (!myStack.empty()) {
myStack.pop();
}
// C) Display the content of the stack
std::stack<int> tempStack = myStack; // Copy to a temporary stack to display
std::cout << "Stack contents: ";
while (!tempStack.empty()) {
std::cout << tempStack.top() << " ";
tempStack.pop();
}
std::cout << std::endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RhY2s+CgppbnQgbWFpbigpIHsKICAgIHN0ZDo6c3RhY2s8aW50PiBteVN0YWNrOwoKICAgIC8vIEEpIEFkZCBhdCBsZWFzdCAxMCBlbGVtZW50cyBpbnRvIHRoZSBzdGFjawogICAgZm9yIChpbnQgaSA9IDE7IGkgPD0gMTA7ICsraSkgewogICAgICAgIG15U3RhY2sucHVzaChpKTsKICAgIH0KCiAgICAvLyBCKSBSZW1vdmUgYW4gZWxlbWVudCBmcm9tIHRoZSBzdGFjawogICAgaWYgKCFteVN0YWNrLmVtcHR5KCkpIHsKICAgICAgICBteVN0YWNrLnBvcCgpOwogICAgfQoKICAgIC8vIEMpIERpc3BsYXkgdGhlIGNvbnRlbnQgb2YgdGhlIHN0YWNrCiAgICBzdGQ6OnN0YWNrPGludD4gdGVtcFN0YWNrID0gbXlTdGFjazsgLy8gQ29weSB0byBhIHRlbXBvcmFyeSBzdGFjayB0byBkaXNwbGF5CiAgICBzdGQ6OmNvdXQgPDwgIlN0YWNrIGNvbnRlbnRzOiAiOwogICAgd2hpbGUgKCF0ZW1wU3RhY2suZW1wdHkoKSkgewogICAgICAgIHN0ZDo6Y291dCA8PCB0ZW1wU3RhY2sudG9wKCkgPDwgIiAiOwogICAgICAgIHRlbXBTdGFjay5wb3AoKTsKICAgIH0KICAgIHN0ZDo6Y291dCA8PCBzdGQ6OmVuZGw7CgogICAgcmV0dXJuIDA7Cn0=