#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+CiNpbmNsdWRlIDxzdHJpbmcuaD4Kdm9pZCBmdW5jKGNoYXIgKmIpCnsKCWNoYXIgKmE9IGIgKyAxOwoJcHJpbnRmKCJpbnB1dCA9ICVzXG4iLCBiKTsKCXdoaWxlICgqYSkKCXsKCQlpZiAoKHN0cmxlbihhKSUoaW50KShhIC0gYikpID09IDAgJiYgc3RybmNtcChhLCBiLCBzdHJsZW4oYSkpID09IDApCgkJewoJCQlwcmludGYoInJlcGVhdCA9ICUuKnNcblxuIiwgKGludCkoYSAtIGIpLCBiKTsKCQkJcmV0dXJuOwoJCX0KCQkrK2E7Cgl9CglwcmludGYoInJlcGVhdCB1bml0IG5vdCBmb3VuZCFcbiIpOwoJcmV0dXJuOwp9CmludCBtYWluKCkKewoJZnVuYygiYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWEiKTsKCWZ1bmMoIjEyMzQxMjMxMjM0MTIzMTIzNDEyMzEyMzQxMjMxMjM0MTIzMTIzNDEyMyIpOwoJZnVuYygib3hveG94b3hveG94b3hveHhveG94b3hveG94b3hveG94eCIpOwoJZnVuYygiYXhheGEiKTsKCXJldHVybiAwOwp9Cg==