#include <cstdio> #include <iostream> using namespace std; #include <stack> int main() { string a; cin>>a; stack<char> sta,stb; //遍历字符串a; for (auto b :a) { //当栈不为空且下个字符与栈顶相等消去,否则入栈 if(!sta.empty()&&b == sta.top()){ sta.pop(); } else { sta.push(b); } } //栈空返回0 if...