0分求助!!!
查看原帖
0分求助!!!
1559473
JmBecca楼主2024/12/7 11:30
#include <bits/stdc++.h>
#include <vector>
using namespace std;
string t,m;
int b=0;
bool check(string s){
	bool n1,n2,n3,n4=false;
	int cnt;
	if(s.length()<6 or s.length()>12)return false;
	else{
		for(int j=0;j<m.length();j++){
			if (m[j]>='0' and m[j]<='9')n1=true;
			else if(m[j]>='A' and m[j]<='Z')n2=true;
			else if(m[j]>='a' and m[j]<='z')n3=true;
			else if(m[j]=='!' or m[j]=='@' or m[j]=='#' or m[j]=='$')n4=true;
			else return false;
		}
	}
	if(n1)cnt++;
	if(n2)cnt++;
	if(n3)cnt++;
	if(cnt>=2 and n4)return true;
}
int main(){
	cin>>t;
	vector<string> a;
	for(int i=0;i<t.length();i++){
		if(t[i]==','){
			a.push_back(t.substr(b,i-b));
			b=i+1;
		}
	}
	a.push_back(t.substr(b,t.length()-b));
	for(int i=0;i<a.size();i++){
		m=a[i];
		if(check(m))cout<<m<<endl;
	}
	return 0;
}

 
2024/12/7 11:30
加载中...