#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;
#define maxn 10
char s[maxn];
bool solve()
{
int len = strlen(s);
int tmp = len/3;
if(len % 3)
return false;
for(int j=0; j<len; j+=tmp)
{
for(int k=j; k<j+tmp-1; k++)
if(s[k] != s[k+1])
return false;
if(s[j] == s[j+tmp]) return false;
}
return true;
}
int main()
{
while(~scanf("%s", s))
{
if(solve())
cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
return 0;
}
BC 水水就好
最新推荐文章于 2024-07-21 09:59:35 发布