1 solutions

  • 1
    @ 2025-11-9 9:19:47
    #include<bits/stdc++.h>
    using namespace std;
    bool check(string s1)
    {
    	string s2=s1;
    	reverse(s2.begin(),s2.end());
    	if(s1==s2) return true;
    	return 0;	
    } 
    int main()
    {
    	int T;
    	cin>>T;
    	while(T--)
    	{
    		string s;
    		cin>>s;
    		int n=s.size();
    		int cnt=0;
    		for(int i=2;i+1<n;i++)
    		{
    			string s1=s.substr(0,i);
    			string s2=s.substr(i);
    		//	cout<<s1<<" "<<s2<<endl;
    			if(check(s1)&&check(s2))
    			{
    				cnt++;
    			}
    		}
    		if(cnt) cout<<"Yes"<<endl;
    		else cout<<"No"<<endl;
    	}
    	return 0;
    }
    
    
    • 1

    Information

    ID
    2198
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    9
    Tags
    # Submissions
    10
    Accepted
    4
    Uploaded By