题意:总结下来就是看有没有连续的三个A,B,C顺序不限
思路:没有,,6个if就好了
上代码:
#include <bits/stdc++.h>
using namespace std;
int main()
{
string ch;
cin>>ch;
int len = ch.size();
// printf("%d\n",'A');
for(int i = 0 ; i < len ; i++)
{
if(ch[i] == 'A')
{
if(ch[i+1] == 'B' && ch[i+2] == 'C')
{
puts("YES");
return 0;
}
if(ch[i+1] == 'C' && ch[i+2] == 'B')
{
puts("YES");
return 0;
}
}
if(ch[i] == 'B')
{
if(ch[i+1] == 'A' && ch[i+2] == 'C')
{
puts("YES");
return 0;
}
if(ch[i+1] == 'C' && ch[i+2] == 'A')
{
puts("YES");
return 0;
}
}
if(ch[i] == 'C')
{
if(ch[i+1] == 'B' && ch[i+2] == 'A')
{
puts("YES");
return 0;
}
if(ch[i+1] == 'A' && ch[i+2] == 'B')
{
puts("YES");
return 0;
}
}
}
puts("NO");
return 0;
}