#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<char> stack(0);
char tmp;
do{
cin>>tmp;
if(tmp != '#'){
if(tmp != '$'){
stack.push_back(tmp);
}else{
stack.pop_back();
}
}
}while(tmp != '#');
for(int i = 0; i < stack.size();i++){
cout << stack[i];
}
cout<< endl;
return 0;
}
C++用Vector实现栈的功能小试牛刀
最新推荐文章于 2023-02-09 15:26:22 发布