#include<iostream>
#include<string>
using namespace std;
int check(string s);
int main(){
string input;
while(cin>>input){
int sum = 0;
int a = 0, b = 0, c = 0, d = 0;
int len = input.length();
if(len < 8){ cout << "NG"<< endl; continue; }
for(int i = 0; i < len; i++){
if(input[i] >= 'a' && input[i] <='z') a = 1;
else if(input[i] >= 'A' && input[i] <='Z') b = 1;
else if(input[i] >= '0' && input[i] <='9') c = 1;
else
d = 1;
}
//cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
sum = a + b + c + d;
int wrong = check(input);
if(sum < 3 || wrong) { cout << "NG"<< endl; continue; }
cout<<"OK"<<endl;
}
}
int check(string s){
string str;
int lenN = s.length();
for(int i = 0; i < s.length() - 4; i++){
for(int j = 2; j < lenN/2; j++){
int position = i + j;
if(s.find(s.substr(i, j),position) != s.npos){
// cout<<" i found the 重复子串"<<endl;
return 1;
}
}
}
return 0;
}
密码验证合格程序
最新推荐文章于 2022-08-23 15:02:49 发布