scientific_comp_projects/CODE/[python]kattis/trivial/alphabet_spam.py
2021-10-29 15:16:40 +02:00

34 lines
614 B
Python

spam = input()
# Getting the number of different characters
total = len(spam)
# Spaces
#spaces = spam.count('_')
#spam = spam.replace('_','')
# Lower, upper or other :
upper = 0
lower = 0
other = 0
space = 0
for carac in spam :
if carac.isupper():
upper += 1
elif carac.islower():
lower += 1
elif carac == '_':
space += 1
else :
other += 1
# Getting the relative quantity.
spaces_rev = space / total
upper_rev = upper / total
lower_rev = lower / total
other_rev = other / total
# Print
print(spaces_rev)
print(lower_rev)
print(upper_rev)
print(other_rev)