混乱的LGH(字符串)

Link:http://acm.hdu.edu.cn/diy/contest_showproblem.php?pid=1004&cid=25995


混乱的LGH

Time Limit : 3000/1000ms (Java/Other)   Memory Limit : 65535/32768K (Java/Other)
Total Submission(s) : 23   Accepted Submission(s) : 12
Font: Times New Roman | Verdana | Georgia
Font Size:  

Problem Description

  有一天,SCNUACM 的LGH 脑袋被门夹到了,结果脑袋那个了。。。。。。。从此写出来的句子没有一个人看得懂,从此你们懂的。。。此时大师出现了,大师通过研究发现LGH 应该是脑袋里的字符映射出错了,例如a 被当成c 用,d 当成e 用等等。现在大师通过统计,得出整个映射表,由于大师太忙了,现在需要你来帮忙翻译LGH 写的句子。

Input

  第一行有一个正整数T(T ≤ 1000),代表数据组数。
  接下来T 组数据,每组数据第一行有26 个小写英文字母,表示LGH 把正常顺序下的字母当成了对应位置下的字母来使用。第二行是GH 写的一条句子,只包含小写字母和空格(包括空格在内的所有字符总长度不超过100)。

Output

  对于每一组数据,输出句子对应的真正意思。

Sample Input

3
zyxwvutsrqponmlkjihgfedcba
r zn ots
apwtuvqscrjmlizhnfxkybgedo
amm ksciqx ci ksucf puciq
apwtuvqscrjmlizhnfxkybgedo
afu qzzt vzf xzluksciq

Sample Output

i am lgh
all things in their being
are good for something

Author

lgh





#include<iostream>
#include<istream>
#include<ostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<cstdio>
#include<map>
using namespace std;
map<char,char>m;
char mt[27],ss[111];
int main()
{ 
    int t,len,i;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%s",&mt);
        getchar();
        for(i=0;i<26;i++)
        {
            m[mt[i]]='a'+i;
        }
        gets(ss);
        len=strlen(ss);
        for(i=0;i<len;i++)
        {
            if(ss[i]>='a'&&ss[i]<='z')
            ss[i]=m[ss[i]];
        }
        puts(ss);
    }
    return 0;
}



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

林下的码路

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值