简介
简单
code
#include <iostream>
#include <string>
#include <set>
#include <algorithm>
using namespace std;
int main() {
string str;
set<string> s;
while(cin >> str) {
if(str.size() <= 8) {
cout << "NG\n";
continue;
}
int check = 0x00;
for(int i=0; i<str.size(); i++){
if(str[i] >= '0' && str[i] <='9') {
check |= 1;
}
else if(str[i] >='a' && str[i] <= 'z') {
check |= 2;
}
else if(str[i] >='A' && str[i] <= 'Z') {
check |= 4;
}
else {
check |= 8;
}
}
int numCheck = 0;
//cout << "ccc " << check << endl;
//cout << (check & 1) << " " << (check & 2) << " " << (check & 4) << " " << (check & 8) << std::endl;
numCheck += (check & 1) > 0 ? 1 : 0;
numCheck += (check & 2) > 0 ? 1 : 0;
numCheck += (check & 4) > 0 ? 1 : 0;
numCheck += (check & 8) > 0 ? 1 : 0;
check = false;
for(int i=0; i<str.size()-2; i++){
for(int j = i+3; j<str.size()-2; j++){
if(str.substr(i,3) == str.substr(j, 3)){
check = true;
}
}
}
// cout << numCheck << " " << check << endl;
if(numCheck >= 3 && !check ){
cout << "OK\n";
}else{
cout << "NG\n";
}
}
return 0;
}
---------------------------我的天空里没有太阳,总是黑夜,但并不暗,因为有东西代替了太阳。虽然没有太阳那么明亮,但对我来说已经足够。凭借着这份光,我便能把黑夜当成白天。我从来就没有太阳,所以不怕失去。
--------《白夜行》