/*sample input3walpurgis(charlotte(patricia,gertrud),elly,gisela)wuzetiannanoha(fate(hayate))*//*DFS把树的字符串1a(b(c,d),e,f)进行深度优先搜索当前房间编号i遇到'('则i-》i+1遇到','则i-》pre_i pre_i-》i+1遇到')'则i-》pre_i 如果pre_i!=1 pre_i-》pre_i' pre_i'-》pre_i+1 */#include#include int T;//T<=20char str[1000002];//Madoka's log <=1000000charschar Witches[50001][11];//at most 50000 roomsint sum_witches,str_i,str_len,name_i,cur_i;//当前结点编号int pre_i[50001];//父结点编号int pass[100002][2];//路线int pass_i;int main(){ char ch; int t,i; scanf("%d",&T); while (T--) { memset(pass,0,sizeof(pass)); pass_i=0; memset(Witches,0,sizeof(Witches)); sum_witches=1; name_i=0; memset(pre_i,0,sizeof(pre_i)); cur_i=1; pre_i[cur_i]=-1; memset(str,0,sizeof(str)); str_i=0; scanf("%s",str); str_len=strlen(str); while (str_i 'z' || str[str_i]<'a') Witches[sum_witches][name_i]='\0'; break; } } printf("%d\n",sum_witches); for (i=1;i