题解 | #密码验证合格程序#
密码验证合格程序
https://www.nowcoder.com/practice/184edec193864f0985ad2684fbc86841
while True: try: s=input() ss=list(s) n=len(s) c=[0 for i in range(4)]#upper,lower,digit,other for i in s: if i.isupper(): c[0]+=1 elif i.islower(): c[1]+=1 elif i.isdigit(): c[2]+=1 else: c[3]+=1 res='' for i in range(n): for j in range(i+1,n): if s[i:j+1] in s[j+1:n] and j+1-i>len(res): res=s[i:j+1] if n>8 and c.count(0)<2 and len(res)<3: print('OK') else: print('NG') except: break
居然一遍过的,我也比较诧异