poj2141

简单题

View Code
   
     
#include < iostream >
#include
< cstdio >
#include
< cstdlib >
#include
< cstring >
using namespace std;

char f[ 30 ];
char st[ 100 ];

int main()
{
// freopen("t.txt", "r", stdin);
gets(f);
gets(st);
for ( int i = 0 ; i < strlen(st); i ++ )
{
if (st[i] <= ' Z ' && st[i] >= ' A ' )
printf(
" %c " ,f[st[i] - ' A ' ] - ' a ' + ' A ' );
else if (st[i] <= ' z ' && st[i] >= ' a ' )
printf(
" %c " , f[st[i] - ' a ' ]);
else
printf(
" %c " , st[i]);
}
printf(
" \n " );
return 0 ;
}

你可能感兴趣的:(poj)