全WA求救
查看原帖
全WA求救
1444395
McdullWang楼主2025/1/26 12:05
#include <bits/stdc++.h>
using namespace std;
bool pd(string b){
	for(int i=0;i<b.size();i++){
		if(!(b[i]>='a'&&b[i]<='z')&&!(b[i]>='A'&&b[i]<='Z')&&!(b[i]>='0'&&b[i]<='9')&&b[i]!='!'&&b[i]!='@'&&b[i]!='#'&&b[i]!='$'){
			return false; 
		}
	}
	if(b.size()<6||b.size()>12){
		return false;
	}
	int tj1=0,tj2=0,tj3=0,tj4=0;
	for(int i=0;i<b.size();i++){
		if(b[i]>='a'&&b[i]<='z'){
			tj1=1;
		}
		if(b[i]>='A'&&b[i]<='Z'){
			tj2=1;
		}
		if(b[i]>='0'&&b[i]<='9'){
			tj3=1;
		}
		if(b[i]=='!'&&b[i]=='@'&&b[i]=='#'&&b[i]=='$'){
			tj4=1;
		}
	}
	if(tj1+tj2+tj3>=2&&tj4){
		return true;
	}else{
		return false;
	}
}
int main(){
 	string a;
 	cin>>a;
 	for(int i=0;i<a.size();i++){
 		if(a[i]==','){
 			if(pd(a.substr(0,i))){
 				cout<<a.substr(0,i)<<endl;	
			}
		}
	}
    return 0;
}
2025/1/26 12:05
加载中...