题解 | #密码验证合格程序#
密码验证合格程序
https://www.nowcoder.com/practice/184edec193864f0985ad2684fbc86841
while True:
try:
code = input()
if len(code) < 8:
print('NG')
continue
a, b, c, d = 0, 0, 0, 0
for i in code:
if ord('a') <= ord(i) <= ord('z'):
a = 1
elif ord('A') <= ord(i) <= ord('Z'):
b = 1
elif ord('0') <= ord(i) <= ord('9'):
c = 1
else:
d = 1
ty = a + b + c + d
if a + b + c + d < 3:
print('NG')
continue
repeat = 0
for i in range(len(code) - 3):
if len(code.split(code[i:i + 3])) > 2:
repeat += 1
if repeat > 0:
print('NG')
continue
print('OK')
except:
break