You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.1 KiB

1 year ago
#include <bits/stdc++.h>
using namespace std;
void check(string t) {
// 1、必须有大写小写数字三种中的两种
int dx = 0, xx = 0, sz = 0, ts = 0;
// 2、四个特殊字符必须有一个
// !@#$
// 3、不能出现其它字符
for (int i = 0; i < t.size(); i++) {
if (t[i] >= 'A' && t[i] <= 'Z')
dx = 1;
if (t[i] >= 'a' && t[i] <= 'z')
xx = 1;
if (t[i] == '!' || t[i] == '@' || t[i] == '#' || t[i] == '$')
ts = 1;
if (t[i] >= '0' && t[i] <= '9')
sz = 1;
if (!(t[i] >= 'A' && t[i] <= 'Z') && !(t[i] >= 'a' && t[i] <= 'z') && !(t[i] >= '0' && t[i] <= '9') &&
t[i] != '!' && t[i] != '@' && t[i] != '#' && t[i] != '$') {
return;
}
}
if (dx + xx + sz < 2) return;
if (ts == 0) return;
cout << t << endl;
}
int main() {
string s;
cin >> s;
s += ',';
string t = "";
for (int i = 0; i < s.size(); i++) {
if (s[i] == ',') {
check(t);
t = "";
} else
t += s[i];
}
return 0;
}