题解 | #密码验证合格程序#

密码验证合格程序

https://www.nowcoder.com/practice/184edec193864f0985ad2684fbc86841

while True:

    try:

        code = input()

        if len(code) < 8:

            print('NG')

            continue

        a, b, c, d = 0000

        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

全部评论

相关推荐

牛客38347925...:9,2学生暑期实习失利开始投小厂,给这群人整自信了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务