#include #include #include #include using namespace std; int main() { string a,word,w; int i,j,k=0,d,e; getline(cin,a); if(a[0]=='\n'){return 0;} char* b; int c[100]; b=&a[0]; while(strlen(b)!=0 && strlen(b)<=100){ j=0; istringstream iss(a); iss>>word; if (word=="unsigned") iss>>word; if ((word=="char"&&(strlen(b)==4||strlen(b)==5))||(word=="int"&&(strlen(b)==3||strlen(b)==4))||(word=="short"&&(strlen(b)==4||strlen(b)==5)))return 0; if (word=="char"||word=="int"||word=="short"){ w=word; iss>>word; b=&word[0]; if(b[0]==',') return 0; i=0; //if(b[i]=='\0'&&) while(b[i]!='\0'){ if((b[i]<97||b[i]>122)&&b[i]!=','&&b[i]!='['&&b[i]!=']') return 0; if(b[i]==',' && b[i-1]!=']'){j++;} if(b[i]==','&&b[i+1]==',')return 0; e=0; if(b[i]=='[')e=1; while(b[i]=='['){ i++; d=0; while(b[i]!=']'){ if(b[i]<48||b[i]>57) return 0; d=d*10+(b[i]-'0'); i++; } e*=d; if(b[i+1]=='[')i++; } j+=e; i++; } if (b[i-1]!=']')j++; } if (w=="char"){ c[k]=j; } else if (w == "short"){ c[k]=j*2; } else if (w == "int"){ c[k]=j*4; } if (c[k]>=1000000000)return 0; k++;j=0; getline(cin,a); b=&a[0]; } for(i=0;i