3
from collections import Counter5
def mostCommonWord(self, paragraph: str, banned: List[str]) -> str:6
# sunday morning hangover solution haha8
# calling this twice seems unnecesary but whatevs9
# replace "," with " " (apparently translate() is much quicker than replace)10
para = paragraph.translate(str.maketrans(",", " "))11
# strip out rest of punctuation and make it lower case12
para = para.translate(str.maketrans(" ", " ", string.punctuation)).lower()15
# staple counter function16
para_count = Counter(para)17
# loop thru banned words, if they're in para_count pop the off19
if word in para_count:21
# return val from most common22
return para_count.most_common(1)[0][0]