1.长度超过8位
2.包含大小写字母,数字,其他符号,以上四种超三种
3.不能有长度超2的子串重复
#include<stdio.h>
#include<string.h>
int main()
{
char str[100];
while (scanf("%s", str) != EOF)
{
int len = strlen(str);
int i, n1=0,n2=0,n3=0,n4=0,count=0;
int flag = 1;
if (len > 8)
{
for (i = 0; i < len; i++)
{
if (str[i] >= '0' && str[i] <= '9')
n1 = 1;
else if (str[i] >= 'A' && str[i] <= 'Z')
n2 = 1;
else if (str[i] >= 'a' && str[i] <= 'z')
n3 = 1;
else n4 = 1;
count = n1 + n2 + n3 + n4;
if (count >= 3)
break;
}
if (count < 3)
{
flag = 0;
}
if (flag == 1)
{
for (int i = 0; i < len - 5; i++)
{
for (int j = i + 2; j < len - 2; j++)
{
if (str[i] == str[j] && str[i + 1] == str[j + 1] && str[i + 2] == str[j + 2])
{
flag = 0;
break;
}
}
}
}
}
else
{
flag = 0;
}
if (flag == 0)
{
printf("NG\n");
}
else
{
printf("OK\n");
}
}
return 0;
}