這題基本上是小測資版的 UVa 10298。因為測資極小，因此直接從 i = 1 開始，檢測字串是否每 i 次便重複一次。除此之外，必須確定 i 是 strlen 的因數，否則會誤判 abcabcab 之類的字串。 This problem is essentially UVa10298 with a smaller input. Because the inputs are small, we can start from i = 1 and see if the string repeats itself with a period of i. Also, it is necessary to check if i is a divider of strlen, otherwise the results of strings like abcabcab would be wrong.

值得一提的是，我一開始用的演算法是讀取字元，若和 str[p] 相等便將 p 加一，否則將 p 歸零。不過，如此對如 abaaababaaab 等字串便會失效。為了參考，我也將此版本的程式碼貼於正確版本之後。 One thing worth noting is that the algorithm I was using at first works by reading character by character. If the character is the same as str[p], p is incremented, otherwise p is reset to zero. However, this method fails on strings like abaaababaaab. For reference, I’ll post this version of the code under the correct version.