How to solve a question where the string is first circularly rotated by 1 letter, then by 2 letter and soon , at what time the modified string will be equal to original string? these strings are made up using 'a' and 'b' only.
for eg: aabaab is the string on first letter rotation it will become abaaba on second rotation it will become aabaab so answer is 2.
I tried to solve this question but could only do this only by brute force.
Any help will be appreciated.
/predownloaded/31/8c/318cb654fc06c3d0d8aac69f5b814a7a0323a8ca.jpg