Pergunta de entrevista da empresa Glassdoor

Coding question around counting occurrences of words in a larger string