Pergunta de entrevista da empresa Amazon

Two codes test. Second is to find the appearance times for a substring in a larger string.