Problem :

https://www.hackerrank.com/challenges/strong-password/problem


My Solution :

#!/usr/bin/env python3

def minimumNumber(n, password):
    password = set(password)
    cnt = [0]*4
    for c in password:
        if c.isdigit():
            cnt[0] = 1
        elif c.islower():
            cnt[1] = 1
        elif c.isupper():
            cnt[2] = 1
        else:
            cnt[3] = 1
        if sum(cnt) == 4:
            break
    return max(4 - sum(cnt), 6 - n)


n = int(input())
password = input()
answer = minimumNumber(n, password)
print(answer)