Skip to main content
added 520 characters in body
Source Link
TFeld
  • 19.9k
  • 3
  • 20
  • 63

Python 2, 24 bytes

lambda s:s in(s*2)[1:-1]

Try it online!

Shamelessly stolen from xnor's answer to the original question.


More intuitive version:

Python 2, 59 55 53 bytes

lambda s:s in[len(s)/i*s[:i]for i in range(1,len(s))]

Try it online!


Boring regex version:

Python 2, 44 bytes

lambda s:re.match(r'(.+)\1+$',s)>0
import re

Try it online!

Python 2, 59 55 53 bytes

lambda s:s in[len(s)/i*s[:i]for i in range(1,len(s))]

Try it online!


Boring regex version:

Python 2, 44 bytes

lambda s:re.match(r'(.+)\1+$',s)>0
import re

Try it online!

Python 2, 24 bytes

lambda s:s in(s*2)[1:-1]

Try it online!

Shamelessly stolen from xnor's answer to the original question.


More intuitive version:

Python 2, 59 55 53 bytes

lambda s:s in[len(s)/i*s[:i]for i in range(1,len(s))]

Try it online!


Boring regex version:

Python 2, 44 bytes

lambda s:re.match(r'(.+)\1+$',s)>0
import re

Try it online!

deleted 464 characters in body
Source Link
TFeld
  • 19.9k
  • 3
  • 20
  • 63

Python 2, 59 55 53 bytes

lambda s:s in[len(s)/i*s[:i]for i in range(1,len(s))]

Try it online!


Recursive version:

Python 2, 59 54 bytes

f=lambda s,i=1:s[i+1:]and f(s,i+1)or s==len(s)/i*s[:i]

Try it online!


Boring regex version:

Python 2, 44 bytes

lambda s:re.match(r'(.+)\1+$',s)>0
import re

Try it online!

Python 2, 59 55 53 bytes

lambda s:s in[len(s)/i*s[:i]for i in range(1,len(s))]

Try it online!


Recursive version:

Python 2, 59 54 bytes

f=lambda s,i=1:s[i+1:]and f(s,i+1)or s==len(s)/i*s[:i]

Try it online!


Boring regex version:

Python 2, 44 bytes

lambda s:re.match(r'(.+)\1+$',s)>0
import re

Try it online!

Python 2, 59 55 53 bytes

lambda s:s in[len(s)/i*s[:i]for i in range(1,len(s))]

Try it online!


Boring regex version:

Python 2, 44 bytes

lambda s:re.match(r'(.+)\1+$',s)>0
import re

Try it online!

added 13 characters in body
Source Link
TFeld
  • 19.9k
  • 3
  • 20
  • 63

Python 2, 5959 55 53 bytes

lambda s:any(s.replace in[len(s[:i],''s)==''for/i*s[:i]for i in range(1,len(s)))]

Try it online!Try it online!


Recursive version:

Python 2, 5959 54 bytes

f=lambda s,i=0i=1:s[i+1:]and f(s,i+1)or''==s.replaceor s==len(s[s)/i*s[:i],'')

Try it online!Try it online!


Boring regex version:

Python 2, 44 bytes

lambda s:re.match(r'(.+)\1+$',s)>0
import re

Try it online!

Python 2, 59 bytes

lambda s:any(s.replace(s[:i],'')==''for i in range(len(s)))

Try it online!


Recursive version:

Python 2, 59 bytes

f=lambda s,i=0:s[i+1:]and f(s,i+1)or''==s.replace(s[:i],'')

Try it online!


Boring regex version:

Python 2, 44 bytes

lambda s:re.match(r'(.+)\1+$',s)>0
import re

Try it online!

Python 2, 59 55 53 bytes

lambda s:s in[len(s)/i*s[:i]for i in range(1,len(s))]

Try it online!


Recursive version:

Python 2, 59 54 bytes

f=lambda s,i=1:s[i+1:]and f(s,i+1)or s==len(s)/i*s[:i]

Try it online!


Boring regex version:

Python 2, 44 bytes

lambda s:re.match(r'(.+)\1+$',s)>0
import re

Try it online!

added 445 characters in body
Source Link
TFeld
  • 19.9k
  • 3
  • 20
  • 63
Loading
added 473 characters in body
Source Link
TFeld
  • 19.9k
  • 3
  • 20
  • 63
Loading
Source Link
TFeld
  • 19.9k
  • 3
  • 20
  • 63
Loading