import sys
def get_len_score(str1: str) -> int:
str_len: int = len(str1)
score: int = 0
if str_len <= 4:
score = 5
elif 5 <= str_len <= 7:
score = 10
elif str_len >= 8:
score = 25
return score
def get_alpha_score(str1: str):
count1 = 0
count2 = 0
score: int = 0
for x in str1:
ord_x: int = ord(x)
if ord("a") <= ord_x <= ord("z"):
count1 += 1
elif ord("A") <= ord_x <= ord("Z"):
count2 += 1
if count1 >= 1 and count2 >= 1:
score = 20
elif count1 >= 1 or count2 >= 1:
score = 10
else:
score = 0
return score
def get_num_score(str1: str) -> int:
count = 0
score: int = 0
for x in str1:
if x in "0123456789":
count += 1
if count > 1:
score = 20
elif count == 1:
score = 10
else:
score = 0
return score
def get_symbol_score(str1: str) -> int:
count = 0
score: int = 0
for x in str1:
ord_x: int = ord(x)
if (
(int("0x21", 16) <= ord_x <= int("0x2F", 16))
or (int("0x3A", 16) <= ord_x <= int("0x40", 16))
or (int("0x5B", 16) <= ord_x <= int("0x60", 16))
or (int("0x7B", 16) <= ord_x <= int("0x7E", 16))
):
count += 1
if count > 1:
score = 25
elif count == 1:
score = 10
else:
score = 0
return score
def get_score_level(sum_score: int):
level_str = ""
if sum_score >= 90:
level_str = "VERY_SECURE"
elif sum_score >= 80:
level_str = "SECURE"
elif sum_score >= 70:
level_str = "VERY_STRONG"
elif sum_score >= 60:
level_str = "STRONG"
elif sum_score >= 50:
level_str = "AVERAGE"
elif sum_score >= 25:
level_str = "WEAK"
elif sum_score >= 0:
level_str = "VERY_WEAK"
return level_str
for line in sys.stdin:
# print(line)
pwd_str: str = line.rstrip()
# print(pwd_str)
len_score: int = get_len_score(pwd_str)
alpha_score: int = get_alpha_score(pwd_str)
num_score: int = get_num_score(pwd_str)
symbol_score: int = get_symbol_score(pwd_str)
other_score: int = 0
if alpha_score >= 20 and num_score > 0 and symbol_score > 0:
other_score = 5
elif alpha_score >= 10 and num_score > 0 and symbol_score > 0:
other_score = 3
elif alpha_score >= 25 and num_score > 0 and symbol_score > 0:
other_score = 2
else:
other_score = 0
sum_score = len_score + alpha_score + num_score + symbol_score + other_score
# print(len_score)
# print(alpha_score)
# print(num_score)
# print(symbol_score)
# print(other_score)
# print(sum_score)
level = get_score_level(sum_score)
print(level)
蠢笨的方式

京公网安备 11010502036488号