求助,50pts
查看原帖
求助,50pts
1345848
Wyl20110306楼主2024/8/22 22:30
#include<bits/stdc++.h>
using namespace std;
void solve(){
	string s; 
	cin>>s;
	int pos=s.length()-1;
	for(;pos;pos--)
		if(s[pos]!='l'&&s[pos]!='q'&&s[pos]!='b') 
		    break;
	string tmp=s.substr(0,pos+1);
	bool fg=true;
	for(int i=0,j=tmp.length()-1;i<=j;i++,j--){ 
		if(tmp[i]!=tmp[j]){
			fg=false; 
			break;
		}
	}
	cout<<(fg?"Yes":"No")<<"\n";
}
int main(){ 
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t; 
	cin>>t;
	while(t--) solve();
	return 0;
}
2024/8/22 22:30
加载中...