题解 | #密码验证合格程序#
密码验证合格程序
https://www.nowcoder.com/practice/184edec193864f0985ad2684fbc86841
def zhonglei(s): upp = 0 low = 0 num = 0 other = 0 for i in s: if i.isupper(): upp += 1 elif i.islower(): low += 1 elif i.isdigit(): num += 1 else: other += 1 if ( (upp > 0 and low > 0 and num > 0) or (upp > 0 and low > 0 and other > 0) or (low > 0 and other > 0 and num > 0) or (upp > 0 and other > 0 and num > 0) or (upp > 0 and low > 0 and other > 0 and num > 0) ): return True return False def chongfu(s): for i in range(len(s)): if s[i : i + 3] in s[i + 3 :]: return False return True while True: try: s = input() if len(s) >= 8 and zhonglei(s) and chongfu(s): print("OK") else: print("NG") except: break