/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 17ms 2.887 MiB

Code

for _ in range(int(input())):
    s = input()
    d = 0
    u = 0
    l = 0
    sp = 0
    sl = ['!','@','#','$','%','^','&','*','(',')']
    dig = ['0','1','2','3','4','5','6','7','8','9']
    n = len(s)
    if len(s)<8:
        print("invalid")
    
    else:
        for i in s:
            if i in dig:
                d += 1   
            elif i in sl:
                sp += 1   
            elif 97 <= ord(i) <= 122 :
                l += 1    
            elif 65 <= ord(i) <= 90 :
                u += 1

        if d != 0 and u != 0 and l != 0 and sp != 0 :
            print("valid")
        else:
            print("invalid")
        '''else:
        for i in s:
            if i in dig:
                d += 1
                break
        for i in s:
            if i in sl:
                sp += 1
                break
        for i in range(n):
            if 97 <= ord(s[i]) <= 122 :
                l += 1
                break
        for i in range(n):2
            if 65 <= ord(s[i]) <= 90 :
                u += 1
                break'''
    #other way up by a single loop

Information

Submit By
Type
Submission
Problem
P1007 Password Checker
Language
Python 3 (Python 3.12.3)
Submit At
2024-01-02 20:17:32
Judged At
2024-01-02 20:17:32
Judged By
Score
100
Total Time
17ms
Peak Memory
2.887 MiB