3.19 PAT1057 乙级 python

数壹零

x = input()
count = 0
yi = 0
ling = 0
for i in x:
	if i.isalpha():
		count += ord(i.upper())-64
if count == 0:
	print('0 0')
else:
	count = list(bin(count))
	for i in range(2,len(count)):
		if count[i] == '1':
			yi += 1
		else:
			ling += 1
	print(str(ling)+' '+str(yi))

猜你喜欢

转载自blog.csdn.net/qq_39782006/article/details/88667823
今日推荐