import string

def count_letters(word, valid_letters=string.ascii_letters):
    count = Counter(word)
return sum(count[letter] for letter in valid_letters)
How to count the number of letters in a string without the spaces?