def countLetters(word):
counter = {}
for letter in word:
if letter not in counter:
counter[letter] = 0
counter[letter] += 1
return counter
from collections import defaultdict
def countLetters(word):
counter = defaultdict(int)
for letter in word:
counter[letter] += 1
return counter