import re
def letterCount(text,collection):
return sum(len(re.findall(c, text)) for c in collection)
# re.findall(c, text) -> find all occurences of letter c in text
# len(...) -> get the length of the list of all occurrences of c in text
# sum(...) -> sum up all the partial results