I was going through some old question papers of Indian National Olympiad in Informatics and came accross this PDF. In Page Number 5 of this PDF, there's this question about periodic strings.
That for example if "110110" is to be considered a string then it is a periodic string which can be represented as "110"^2. And there's this line saying "Report the answer modulo M". This is where I am confused. I get the question and what it is wanting (some what) but I am still confused about how I should start off. I don't know, maybe the logic isn't clear for me. So, if anyone would help me, like provide me with some more examples and explain to me what the question is asking, it would be very kind of you.
It seems unrelated to me. I don't think the modulo matters, unless there's a way to calculate the result quickly if you know something about the relationship between the number of non-periodic strings and M.
At any rate, you can start out by calculating the number of non-periodic strings, and then just print result % M.