#include <stdio.h>
#include <string.h>
void func(char *b)
{
char *a= b + 1;
while (*a)
{
{
printf("repeat = %.*s\n\n", (int)(a
- b
), b
); return;
}
++a;
}
printf("repeat unit not found!\n"); return;
}
int main()
{
func("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
func("123412312341231234123123412312341231234123");
func("oxoxoxoxoxoxoxoxxoxoxoxoxoxoxoxoxx");
func("axaxa");
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdHJpbmcuaD4Kdm9pZCBmdW5jKGNoYXIgKmIpCnsKICAgIGNoYXIgKmE9IGIgKyAxOwogICAgcHJpbnRmKCJpbnB1dCAgPSAlc1xuIiwgYik7CiAgICB3aGlsZSAoKmEpCiAgICB7CiAgICAgICAgaWYgKHN0cmxlbihhKSA9PSAoaW50KShhIC0gYikgJiYgc3RybmNtcChhLCBiLCBzdHJsZW4oYSkpID09IDApCiAgICAgICAgewogICAgICAgICAgICBwcmludGYoInJlcGVhdCA9ICUuKnNcblxuIiwgKGludCkoYSAtIGIpLCBiKTsKICAgICAgICAgICAgcmV0dXJuOwogICAgICAgIH0KICAgICAgICArK2E7CiAgICB9CiAgICBwcmludGYoInJlcGVhdCB1bml0IG5vdCBmb3VuZCFcbiIpOwogICAgcmV0dXJuOwp9CmludCBtYWluKCkKewogICAgZnVuYygiYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWEiKTsKICAgIGZ1bmMoIjEyMzQxMjMxMjM0MTIzMTIzNDEyMzEyMzQxMjMxMjM0MTIzMTIzNDEyMyIpOwogICAgZnVuYygib3hveG94b3hveG94b3hveHhveG94b3hveG94b3hveG94eCIpOwogICAgZnVuYygiYXhheGEiKTsKICAgIHJldHVybiAwOwp9Cg==