0分求调,样例过了
查看原帖
0分求调,样例过了
1291482
GunSeller楼主2024/3/24 13:43
#include <bits/stdc++.h>
using namespace std;
string str;
string temp[110];
int tag1,tag2,tag3,tag4;
int before=-1;
int main(){
	cin>>str;
	int j=1;
	int n=str.size();
	for(int i=0;i<n;i++){
		if(str[i]==','){
			temp[j++]=str.substr(before+1,i-before-1);
			before=i;
		}
	}
	temp[j]=str.substr(before+1,n-before+1);
	for(int i=1;i<=j;i++){
		tag1=0;tag2=0;tag3=0;tag4=0;
		for(int k=0;k<temp[i].size();k++){
			if(temp[i][k]<'9'&&temp[i][k]>='0'){
				tag1=1;
			}
			else if(temp[i][k]>='A'&&temp[i][k]<='Z'){
				tag2=1;
			}
			else if(temp[i][k]>='a'&&temp[i][k]<='z'){
				tag3=1;
			}
			else if(temp[i][k]=='!'||temp[i][k]=='@'||temp[i][k]=='#'||temp[i][k]=='$'){
				tag4=1;
			}
			else{
				tag4=0;
				break;
			}
		}
		if(tag1+tag2+tag3>=2&&tag4==1&&temp[i].size()>=6&&temp[i].size()<=12)
			cout<<temp[i]<<'\n';
	}
	return 0;
}
2024/3/24 13:43
加载中...