Skip to content

Instantly share code, notes, and snippets.

@sanan-fataliyev
Created March 31, 2021 21:35
Show Gist options
  • Select an option

  • Save sanan-fataliyev/b71dc74eacd640acce8b690a40ecb5d3 to your computer and use it in GitHub Desktop.

Select an option

Save sanan-fataliyev/b71dc74eacd640acce8b690a40ecb5d3 to your computer and use it in GitHub Desktop.
def solution(s):
acc = s[0]
while len(acc) < len(s):
while len(s) % len(acc) != 0:
acc = s[:len(acc)+1]
steps = len(s) // len(acc)
for i in range(1, steps):
if s[i * len(acc):(i + 1) * len(acc)] != acc:
acc = s[:(i * len(acc))+1]
break
else:
return len(s) // len(acc)
return 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment