代码拉取完成,页面将自动刷新
#include <string>
using namespace std;
class Solution {
public:
bool strongPasswordCheckerII(string password) {
int len = password.size();
if (len < 8) return false;
char fl[4] {};
char spe[] = "!@#$%^&*()-+";
if (password[0] <= 'z' && password[0] >= 'a')
fl[0] = 1;
else if (password[0] <= 'Z' && password[0] >= 'A')
fl[1] = 1;
else if (password[0] <= '9' && password[0] >= '0')
fl[2] = 1;
else {
for (int i = 0; i < 12; i++) {
if (password[0] == spe[i]) {
fl[3] = 1;
break;
}
}
}
for (int i = 1; i < len; i++) {
if (password[i] <= 'z' && password[i] >= 'a')
fl[0] = 1;
else if (password[i] <= 'Z' && password[i] >= 'A')
fl[1] = 1;
else if (password[i] <= '9' && password[i] >= '0')
fl[2] = 1;
else {
for (int j = 0; j < 12; j++) {
if (password[i] == spe[j]) {
fl[3] = 1;
break;
}
}
}
if (password[i] == password[i-1]) return false;
}
for (int i = 0; i < 4; i++) {
if (fl[i] != 1) return false;
}
return true;
}
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。