1 solutions

  • 0
    @ 2025-11-5 19:38:21

    C++ :

    #include<iostream>
    #include<cstring>
    using namespace std;
    char ch(char st,int &i)
    {
    	if(st>='A'&&st<='Z')
    		return st+('a'-'A');
    	else
    		return st;
    }
    int main()
    {
    	char st[100010],after[100010],o=0;
    	gets(st);
    	int len=strlen(st);
    	for(int i=0;i<len;i++)
    		after[i]=ch(st[i],i);
    	for(int i=len-1;i>=0;i--)
    	{
    		if(after[i]>='a'&&after[i]<='z')
    			cout << after[i];
    	}
    	cout << endl;
    	bool z=1;
    	int j=0,k=len-1;
    	for( ;j<k;j++,k--)
    	{
    		if(after[j]<'a'||after[j]>'z')
    		{
    			k++;
    			continue;
    		}
    		if(after[k]<'a'||after[k]>'z')
    		{
    			j--;
    			continue;
    		}
    		if(after[j]!=after[k])
    		{
    			z=0;
    			break;
    		}
    	}
    	if(z==0)
    		cout << "no" << endl;
    	else
    		cout << "yes" << endl;
    	return 0;
    }
    
    
    • 1

    Information

    ID
    19486
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By