没有要提交的题目,只是单纯地试验下字符栈,不知道为什么会运行错误,请指教,谢谢!
//s.top()试验 #include<bits/stdc++.h> using namespace std; stack<char> s; int main() { char c; while(cin>>c) { if(s.top()==c) s.pop(); else s.push(c); } while(!s.empty()) { cout<<s.top()<<" "; s.pop(); } return 0; }