题目:用递归颠倒一个栈。例如输入栈{1, 2, 3, 4, 5},1在栈顶。颠倒之后的栈为{5, 4, 3, 2, 1},5处在栈顶。
int main() {
stack<int>s;
s.push(5);
s.push(4);
s.push(3);
s.push(2);
s.push(1);
reverseStack(s);
cout<<s.size()<<endl;
while(!s.empty())
{
cout<<s.top()<<" ";
s.pop();
}
return 0;
}