样例倒是过了。。。
#include <bits/stdc++.h>
using namespace std;
int s = 1;
bool ish(string n) {
int d, x, t, s, m = n.size();
if (m < 6 || m > 12) {
return false;
}
for (int i = 0; i < m; i ++) {
if (n[i] <= 'Z' && n[i] >= 'A')
++ d;
else if (n[i] <= 'z' && n[i] >= 'a')
++ x;
else if (n[i] == '!' || n[i] == '@' || n[i] == '#' || n[i] == '$')
++ t;
else if (n[i] <= '9' && n[i] >= '0')
++ s;
else {
return false;
}
}
if (d >= 2 && x >= 2 && t >= 1 && s >= 2)
return true;
return true;
}
string x, a[200];
int main() {
getline(cin, x);
for (int i = 0; i < x.size(); i ++) {
if (x[i] == ',') {
if (ish(a[s]))
cout << a[s] << endl;
++ s;
}
else
a[s] += x[i];
}
if (ish(a[s]))
cout << a[s];
return 0;
}
看上去似乎好像应该貌似可能是对的吧