Created
November 10, 2016 01:45
-
-
Save refi64/e656ba6088632c37b95bc5b900ce7f8c to your computer and use it in GitHub Desktop.
This file contains 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
import re | |
def myfunc(s): | |
m = re.match(r'^(.+?)\1+$', s) | |
return len(s)/len(m.groups()[0]) | |
print(myfunc('abccbaabccba')) | |
print(myfunc('abcabcabcabc')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment