#include #include #include using namespace std; char x[11111]; int main() { while (gets(x)) { char *p; p = strtok(x, ", "); int am; int res = 0; while (p) { string xx = string(p); if (xx == "unsigned") { p = strtok(NULL, " ,"); continue; } else if (xx == "char") am = 1; else if (xx == "short") am = 2; else if (xx == "int") am = 4; else { int pula = 1; int cur = 0; bool have = 0; for (int i = 0; i < xx.size(); ++i) { if (xx[i] == '[') { cur = 0; have = 1; } if (xx[i] == ']') { pula = pula * cur; cur = 0; have = 0; } if (have && isdigit(xx[i])) cur = cur * 10 + xx[i] - '0'; } res += am * pula; } p = strtok(NULL, " ,"); } printf("%d\n", res); } return 0; }