#要注意边界是否包含 import sys while True: try: password = input().strip() if len(password) <= 8: print("NG") continue check = [0,0,0,0] for c in password: if c.isupper(): check[0] = 1 elif c.islower(): check[1] = 1 elif c.isdecimal(): check[2] = 1 else: check[3] = 1 p_sum = sum(check) if p_sum < 3: print("NG") continue isOK = True if len(password) >= 6: for i in range(len(password) - 3): if password[i:i+3] in password[i+3:]: print("NG") isOK = False break if isOK: print("OK") except: # print(sys.exc_info()) break