#include #include int check(char *str,int s,int e){ int w,i; w=(e-s+1)/2; for(i=0;ij+1;k--){ if(check(str,k,n-1)){ c++; } } } } } }*/ memset(num,-1,sizeof(num)); for(i=n-1;i>2;i--){ if(check(str,i,n-1)){ for(j=i-1;j>1;j--){ if(num[j]<0){ num[j]=0; for(k=j-1;k>0;k--){ if(check(str,k,j-1)){ if(check(str,0,k-1)){ num[j]++; c++; } } } }else{ c+=num[j]; } } } } printf("%ld\n",c); return 0; }