Pergunta de entrevista da empresa Walmart Global Tech

How do I code the most duplicated substring in a given string?