看了好久第三条看不懂ORZ  看大家讨论的好像是不能有长度大于2的子串重复... 
1、正则表达
#include <bits/stdc++.h>
using namespace std;
string regstr[4] = {"[0-9]", "[a-z]","[A-Z]","[^0-9a-zA-Z]"};
bool Test(string s)
{
    int stype = 0;
    if(s.length()>8)
    {
        for(int i = 0; i<4; i++)
        {
            regex reg(regstr[i]);
            if(regex_search(s,reg))
                stype++;
        }
        if (stype >=3)
        {
            regex reg("(...)(.*\\1)");    //第一个括号代表...被捕获了,\\1表示第1个被捕获的内容再出现一次
            if(regex_search(s,reg))
                return false;
            else 
                return true;        
        }
        else
          return false;
    }
    else
          return false;
}

int main()
{
    string str;
    while(cin>>str)
    {
        if(Test(str))
            cout<<"OK"<<endl;
        else
            cout<<"NG"<<endl;
    }
    
    return 0;
}