How to solve this problem ,

Правка en2, от abcyyyy, 2018-08-13 23:26:52

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

Теги #strings, #c++

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en4 Английский abcyyyy 2018-08-13 23:31:40 35 Tiny change: ' force. \n\nAny he' -> ' force. \nhttps://pasteboard.co/Hz1WUBx.jpg\n\nAny he'
en3 Английский abcyyyy 2018-08-13 23:27:27 69 Reverted to en1
en2 Английский abcyyyy 2018-08-13 23:26:52 69
en1 Английский abcyyyy 2018-08-13 23:25:08 501 Image is attached (published)