50分求条!
查看原帖
50分求条!
1102819
comcnSBhhh楼主2024/7/12 14:53
#include<bits/stdc++.h>
using  namespace std;
string s;
stack<char>op;
int main()
{
	cin>>s;
	int len=s.size();
	for(int j=1;j<=100000;j++)
	{
		for(int i=0;i<len;i++)
		{
			if(op.empty())
			{
				op.push(s[i]);
			}
			else
			{
				if(op.top()!=s[i])
				{
					op.push(s[i]);
				}
				else
				{
					op.pop();
				}
			}
		}
		if(op.empty())
		{
			len/=2;
		}
	}
	cout<<len<<endl;
	return 0;
} 
2024/7/12 14:53
加载中...