代码展示:
txt = input().lower()
# txt = 'PAT (Basic)'.lower()
total = 0
find = False
for char in txt:
if 'a'<=char<='z':
total += ord(char) - ord('a') + 1
find = True
# print(total)
binary_char = bin(total)[2:]
# print(binary_char,type(binary_char))
if find:
print(binary_char.count('0'),binary_char.count('1'))
else:
print(0 ,0)
测评结果: