Pergunta de entrevista da empresa Data Axle

Code : maximum repeating substring in string. Ex: abcdefabcd answer must be abcd.