Pergunta de entrevista da empresa Amazon

problem was regarding strings and words occurrences. it had many follow up where we started building different solution with different data structures