📜  将字符串分成重复的子字符串 - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:28.378000             🧑  作者: Mango

代码示例1
a = "hellohellohello"

def splitstring(string):
    for number in range(1, len(string)):
        if string[:number] == string[number:number+number]:
            return string[:number]
    #in case there is no repetition
    return string

splitstring(a)