可借鉴,别举报。
#include<bits/stdc++.h>
using namespace std;
bool is(const string &s, int start, int end)
{
while (start < end)
{
if (s[start] != s[end])
{
return false;
}
start++;
end--;
}
return true;
}
bool c(const string &s)
{
int n = s.length();
for(int i=2;i<=n-2;++i)
{
if(is(s,0,i-1)&&is(s,i,n-1))
{
return true;
}
}
return false;
}
int main()
{
int n;
cin >> n;
for (int i = 0; i < n;++i)
{
string s;
cin >> s;
if (c(s))
{
cout << "Yes" << endl;
} else
{
cout << "No" << endl;
}
}
return 0;
}