Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def cyclicString(s)
- answer = 1
- while (answer < s.length)
- correct = true
- position = 0
- while (position + answer < s.length)
- if s[position] != s[position + answer] then
- correct = false
- break
- end
- position = position + 1
- end
- if correct == true then
- return answer
- end
- answer = answer + 1
- end
- return s.length
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement