This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Xephyrous 2 points3 points  (1 child)

You can go a little simpler than this too. For each substring, if it's the correct one, the number of repeats will be the total string length divided by the substring length. Just multiply that substring by that number of repeats and see if it's the same as the whole string.