此题目练习编码的,C++用gets()函数会有警告哦。
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string.h>
const int maxn = 90;
char str[30];
char read[maxn];
void work()
{
int len = strlen(read);
for(int i = 0; i < len; i++) {
if(read[i] >= 'a' && read[i] <= 'z') putchar(str[read[i]-'a']);
else if(read[i] >= 'A' && read[i] <= 'Z') putchar(str[read[i]-'A']-'a'+'A');
else putchar(read[i]);
}
printf("\n");
}
int main()
{
while(scanf("%s", str) != EOF) {
getchar();
gets(read);
work();
}
return 0;
}