#include <stdio.h>
#include <string.h>
void func(char *s)
{
for (int i = 1; i <= n / 2; ++i)
{
if (n % i == 0)
{
{
printf("repeat = %.*s\n\n", i
, s
); return;
}
}
}
printf("repeat unit not found!\n\n"); return;
}
int main()
{
func("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
func("123412312341231234123123412312341231234123");
func("oxoxoxoxoxoxoxoxxoxoxoxoxoxoxoxoxx");
func("axaxa"); // repeat = ax
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdHJpbmcuaD4Kdm9pZCBmdW5jKGNoYXIgKnMpCnsKICAgIGludCBuID0gc3RybGVuKHMpOwogICAgcHJpbnRmKCJpbnB1dCAgPSAlc1xuIiwgcyk7CiAgICBmb3IgKGludCBpID0gMTsgaSA8PSBuIC8gMjsgKytpKQogICAgewogICAgICAgIGlmIChuICUgaSA9PSAwKQogICAgICAgIHsKICAgICAgICAgICAgaWYgKHN0cm5jbXAocywgcyArIGksIHN0cmxlbihzICsgaSkpID09IDApCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHByaW50ZigicmVwZWF0ID0gJS4qc1xuXG4iLCBpLCBzKTsKICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KICAgIHByaW50ZigicmVwZWF0IHVuaXQgbm90IGZvdW5kIVxuXG4iKTsKICAgIHJldHVybjsKfQppbnQgbWFpbigpCnsKICAgIGZ1bmMoImFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhIik7CiAgICBmdW5jKCIxMjM0MTIzMTIzNDEyMzEyMzQxMjMxMjM0MTIzMTIzNDEyMzEyMzQxMjMiKTsKICAgIGZ1bmMoIm94b3hveG94b3hveG94b3h4b3hveG94b3hveG94b3hveHgiKTsKICAgIGZ1bmMoImF4YXhhIik7IC8vIHJlcGVhdCA9IGF4CiAgICByZXR1cm4gMDsKfQo=