Created
March 31, 2021 21:35
-
-
Save sanan-fataliyev/b71dc74eacd640acce8b690a40ecb5d3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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