Answers for "seprate strings into repititive substrings"

0

seprate strings into repititive substrings

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)
Posted by: Guest on July-12-2020

Code answers related to "seprate strings into repititive substrings"

Browse Popular Code Answers by Language