choose a substring of A which contains '1' an even number of times and reverse this substring. code example
Example: 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)