Cute_QiQi @ 2024-03-13 21:21:15
#include <iostream>
#include <string>
#include <cstring>
#define elif else if
using namespace std;
string s, s1 = "";
bool f (string s) {
short i1, i2, it, ii;
for (int i = 0; i < s.size(); i++) {
if (s[i] >= 'a' and s[i] <= 'z') i1 = 1;
elif (s[i] >= 'A' and s[i] <= 'Z') i2 = 1;
elif (s[i] >= '0' and s[i] <= '9') it = 1;
elif (s[i] == '!' or s[i] == '@' or s[i] == '#' or s[i] == '$') ii = 1;
else return 0;
}
if (!ii) return 0;
if (i1 + i2 + it <= 1) return 0;
return 1;
}
signed main () {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> s;
for (int i = 0; i < s.size(); i++) {
if (s[i] != ',') {
s1 += s[i];
}
else {
if (f(s1)) cout << s1 << endl;
s1 = "";
}
}
return 0;
}
谢谢,QaQ
by Getting302 @ 2024-03-30 13:09:24
我提个建议,可以把头文件换成include<bits/stdc++.h>
by zhsea911 @ 2024-04-01 16:15:52
截取的s1长度要求在6-12之间,要判别一下。
by sd_JC @ 2024-04-15 16:00:22
你怎么能写elif
?这是C++,c++写的是else if
,最根本的语法错误,那坑定错啦
by li_ji_feng @ 2024-06-09 09:34:52
@sd_JC #define elif else if不是有这个吗?
by sd_JC @ 2024-06-09 14:28:44
@l36553779l2 o,对也,我眼瞎了