#include #include #include #include std::map vars; char c, s[105], *vs; char* next() { vs+=2; return vars[*vs]; } int main(){ int n; scanf("%d ", &n); while(n--){ scanf("%c=%s ", &c, s); vars[c] = strdup(s); } fgets(s, 105, stdin); vs = strchr(s, ',') - 1; vs[1] = 0; for(char *w = strtok(s, " "); w != NULL; w = strtok(NULL, " ")){ char type = w[strlen(w) - 1]; if(w[0] != '%') printf(w); else if(type == 's') printf(w, next()); else if(type == 'd') printf(w, atoi(next())); else printf(w, atof(next())); putchar(' '); } return 0; }