#include #include #define N 100 char str[N]; int cmp(int a, int b, int c) { char s1[100]; strcpy(s1,str+a); s1[b-a+1]=0; if (strlen(s1) < strlen(str+c)) return -1; if (strlen(s1) > strlen(str+c)) return 1; // printf("%s %s %d\n", s1, str+c, strcmp(s1,str+c)); return strcmp(s1,str+c); } int main() { int i,j,dl; int dyn[40],b,bad,sum; while (1) { scanf("%s", str); if (str[0]=='#') break; dl=strlen(str); bad=0; sum=0; for ( b=1; b0) printf("The code %s can represent %d numbers.\n", str, sum); else printf("The code %s is invalid.\n", str); } return 0; }