题解 | #密码验证合格程序#
密码验证合格程序
https://www.nowcoder.com/practice/184edec193864f0985ad2684fbc86841
def jg(pw):
if len(pw) < 9:
return 'NG'
a, b, c, d = 0, 0, 0, 0
for i in pw:
if i.isdigit():
a = 1
elif ord(i) in range(65, 91):
b = 1
elif ord(i) in range(97, 123):
c = 1
else:
d = 1
if a + b + c + d < 3:
return 'NG'
else:
for i in range(len(pw) - 2):
if pw.count(pw[i] + pw[i + 1] + pw[i + 2]) > 1:
return 'NG'
return 'OK'
while True:
try:
pw = input()
print(jg(pw))
except:
break