http://acm.hust.edu.cn/vjudge/contest/view.action?cid=34121#problem/C
// File Name: c.cpp // Author: bo_jwolf // Created Time: 2013年10月16日 星期三 16:08:12 #include<vector> #include<list> #include<map> #include<set> #include<deque> #include<stack> #include<bitset> #include<algorithm> #include<functional> #include<numeric> #include<utility> #include<sstream> #include<iostream> #include<iomanip> #include<cstdio> #include<cmath> #include<cstdlib> #include<cstring> #include<ctime> using namespace std; stack< char > Q; stack< char >P; int main(){ char temp; while( cin >> temp ){ if( Q.empty() || Q.top() != temp ){ Q.push( temp ); } else{ Q.pop(); } } while( Q.size() ){ P.push( Q.top() ); Q.pop(); } while( P.size() ){ cout << P.top(); P.pop(); } cout << endl; return 0; }