설명할 것이 없다.
#include<stdio.h>
#include<string.h>
static char str[26];
static int T;
int Proc(char* a, int asz, char* b, int bsz){
char base[26] = { 0 };
int blen = asz + bsz;
int i, j;
int ret = 0;
if (blen == 0){
return 1;
}
memcpy(base, a, asz);
memcpy(base + asz, b, bsz);
for (i = 0; i < blen; i = j){
j = i;
while (base[i] == base[j++]);
--j;
if (j - i >= 2){
if (Proc(base, i, base + j, blen - j)){
return 1;
}
}
}
return 0;
}
int main(){
for (scanf("%d", &T); T--;){
scanf("%s", str);
printf("%d\n", Proc(str, strlen(str), NULL, 0));
}
}
