#include<iostream>
#include<queue>
#include<string>
#include<stack>
using namespace std;
void reverse(stack<int>& s)
{
stack<int> temp;
while(!s.empty())
{
int top=s.top();
s.pop();
if(temp.empty())//如果是空直接放进去
temp.push(top);
else if(temp.top()>top)//如果temp.top大也直接放进去
temp.push(top);
else
{
while(!temp.empty()&&temp.top()<top)//注意这里,这里必须要empty在前不然会引发top异常
{
int t=temp.top();
temp.pop();
s.push(t);
}
temp.push(top);
}
}
while(!temp.empty())
{
int mm=temp.top();
temp.pop();
s.push(mm);
}
}
int main()
{
stack<int> a;
for(int i=;i>=;i--)
{
a.push(i);
}
reverse(a);
for(int i=;i>=;i--)
{
cout<<a.top();
a.pop();
}
return ;
}