From 6423ca5bd30a40a8d6f6d29f2766df7947551e0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=B5=B7?= <10402852@qq.com> Date: Sat, 10 Feb 2024 19:31:22 +0800 Subject: [PATCH] 'commit' --- TangDou/51NOD/Test.cpp | 45 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/TangDou/51NOD/Test.cpp b/TangDou/51NOD/Test.cpp index abb7659..3f93d02 100644 --- a/TangDou/51NOD/Test.cpp +++ b/TangDou/51NOD/Test.cpp @@ -1,8 +1,47 @@ #include using namespace std; +int sz; +int dx; +int xx; +int ts; +int jcq; +string len; +string str; int main() { - int a = 7; - int b = (a & (-3)); - cout << b << endl; + cin >> str; + for (int i = 0; i < str.size(); i++) { + if (str[i] == ',' || i == str.size() - 1) { + // check + /* + 1,排除非法字符(看jcq)如果是,跳过。 + 2,长短限制:6~12 + 3,数字+大写+小写>=2,特殊》=1. + */ + if (jcq > 0) continue; + if (len.size() < 6 || len.size() > 12) continue; + if (sz + dx + xx < 2) continue; + if (ts < 1) continue; + cout << len << endl; + // clear + sz = 0; + dx = 0; + xx = 0; + ts = 0; + len = ""; + jcq = 0; + } else { + len += str[i]; + if (str[i] <= '9' && str[i] >= '0') { + sz = true; + } else if (str[i] <= 'Z' && str[i] >= 'A') { + dx = true; + } else if (str[i] <= 'z' && str[i] >= 'a') { + xx = true; + } else if (str[i] == '!' || str[i] == '@' || str[i] == '#' || str[i] == '$') { + ts = true; + } else + jcq++; + } + } return 0; } \ No newline at end of file