作业介绍

#include <bits/stdc++.h>
using namespace std;
string str1,str2;
int n;
int judge(string a)
{
	string b = "";
	for(int i=a.size()-1;i>=0;i--){
		b+=a[i];
	}
	if(a==b)return 1;
	else return 0;
}
int lx(string str)
{
	int number = 0,letter = 0;
	for(int i=0;i<str.size();i++){
		if(str[i]>='0' && str[i]<='9')number++;
		if(str[i]>='a' && str[i]<='z')letter++;
		if(str[i]>='A' && str[i]<='Z')letter++;
	}
	if(number==0)return 1;
	else if(letter==0)return 2;
	else return 3;
}
int main()
{
	freopen("string.in","r",stdin);
	freopen("string.out","w",stdout);
	cin>>str1>>str2>>n;
	for(int i=1;i<=n;i++){
		string pos;
		cin>>pos;
		string new_str="";
		for(int j=0;j<pos.size();j++){
			if(pos[j]=='a')new_str+=str1;
			else new_str+=str2;
		}
		cout<<new_str<<endl;
		if(judge(new_str)){
			cout<<"palindrome"<<' ';
		}
		else cout<<"non-palindrome"<<' ';
		int t = lx(new_str);
		if(t==1)cout<<"letter"<<endl; 
		if(t==2)cout<<"number"<<endl;
		if(t==3)cout<<"string"<<endl;
	}
	return 0;
 } 
状态
已结束
题目
28
开始时间
2022-7-5 0:00
截止时间
2023-8-31 23:59
可延期
0 小时