啊一个比较慢的题解(0s)
2025-05-01 12:27:51
发布于:四川
5阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
int main(){
string a, b;
cin >> a >> b;
int n;
cin >> n;
while(n--) {
string s;
cin >> s;
string t = "";
for(int i = 0; i < s.size(); i++) {
if(s[i] == 'a') t += a;
else t += b;
}
cout << t << endl;
string t1 = "";
for(int i = t.size() - 1; i >= 0; i--) {
t1 += t[i];
}
if(t1 == t) cout << "palindrome ";
else cout << "non-palindrome ";
int shu = 1, zifu = 1;
for(int i = 0; i < t.size(); i++){
if(t[i] < '0' || t[i] > '9')
shu = 0;
else{
zifu = 0;
}
}
if(shu == 0 && zifu == 1)
cout << "letter" << endl;
else if(zifu == 0 && shu == 1)
cout << "number" << endl;
else
cout << "string" << endl;
}
return 0;
}
这里空空如也
有帮助,赞一个