#include using namespace std; double trf ( const char * s ){ istringstream iss(s) ; double res ; iss >> res ; return (res) ; } int trd ( const char * s ){ istringstream iss(s) ; int res ; iss >> res ; return (res) ; } int main( int argc, char ** argv ){ int n ; cin >> n ; char var_name[128]={0}; int t = 0 ; char values[10][100]={0}; while(n--) { char ch ; cin >> ch ; var_name[ch]=t; ++ t ; cin.get() ; cin.getline( values[var_name[ch]] ,100, '\n' ) ; } char P[102]={0} ; cin.getline( P ,100, '\n' ) ; int p = strchr(P , ',') - P + 1 ; t = p ; for ( int i = 0 ; i < t-1 && P[i] != ',' ; ++ i ) { if ( P[i] == '%' ) { ++ i ; if( P[i] == 's' ) cout << values[var_name[P[p]] ]; else { char buff[5]={0} ; int bi = 1 ; buff[0] = '%' ; while ( P[i] != ' ' && P[i] != ',' ) { buff[bi++] = P[i++] ; } if (buff[bi-1] == 'f') printf(buff, trf( values[var_name[P[p]]] ) ) ; else if ( buff[bi-1] == 'd' ) printf(buff, trd( values[var_name[P[p]]] ) ) ; printf(" "); } p += 2 ; } else cout << P[i]; } return (0); }