1 条题解

  • 0
    @ 2025-4-12 21:36:06

    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

    信息

    ID
    836
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者