B. Keyboard Layouts
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

There are two popular keyboard layouts in Berland, they differ only in letters positions. All the other keys are the same. In Berland they use alphabet with 26 letters which coincides with English alphabet.

You are given two strings consisting of 26 distinct letters each: all keys of the first and the second layouts in the same order.

You are also given some text consisting of small and capital English letters and digits. It is known that it was typed in the first layout, but the writer intended to type it in the second layout. Print the text if the same keys were pressed in the second layout.

Since all keys but letters are the same in both layouts, the capitalization of the letters should remain the same, as well as all other characters.

Input

The first line contains a string of length 26 consisting of distinct lowercase English letters. This is the first layout.

The second line contains a string of length 26 consisting of distinct lowercase English letters. This is the second layout.

The third line contains a non-empty string s consisting of lowercase and uppercase English letters and digits. This is the text typed in the first layout. The length of s does not exceed 1000.

Output

Print the text if the same keys were pressed in the second layout.

Examples
Input
qwertyuiopasdfghjklzxcvbnm
veamhjsgqocnrbfxdtwkylupzi
TwccpQZAvb2017
Output
HelloVKCup2017
Input
mnbvcxzlkjhgfdsapoiuytrewq
asdfghjklqwertyuiopzxcvbnm
7abaCABAABAcaba7
Output
7uduGUDUUDUgudu7
map构建映射就可以了
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f3f
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
map<char,char>m;
map<int,char>p;
char a[],b[];
int main()
{
scanf("%s",&a);
for(int i=;i<;i++)
{
p[i+]=a[i];
}
scanf("%s",&a);
for(int i=;i<;i++)
{
m[p[i+]]=a[i];
}
scanf("%s",&b);
for(int i=;b[i]!='\0';i++)
{
if(b[i]>='' && b[i]<='') printf("%c",b[i]);
else
{
if(b[i]>='A' && b[i]<='Z')
printf("%c",toupper(m[tolower(b[i])]));
else printf("%c",m[b[i]]);
}
}
printf("\n");
}

Codefroces 831B Keyboard Layouts的更多相关文章

  1. codeforces 831B. Keyboard Layouts 解题报告

    题目链接:http://codeforces.com/contest/831/problem/B 题目意思:给出两个长度为26,由小写字母组成的字符串s1和s2,对于给出的第三个字符串s3,写出对应s ...

  2. Codeforces831B Keyboard Layouts

    B. Keyboard Layouts time limit per test 1 second memory limit per test 256 megabytes input standard ...

  3. Codeforces Round #424 B. Keyboard Layouts(字符串,匹配,map)

    #include <stdio.h> #include <string.h> ][]; ]; ]; int main(){ scanf(]); scanf(]); scanf( ...

  4. 【Codeforces Round #424 (Div. 2) B】Keyboard Layouts

    [Link]:http://codeforces.com/contest/831/problem/B [Description] 两个键盘的字母的位置不一样; 数字键的位置一样; 告诉你第一个键盘按某 ...

  5. CF831B Keyboard Layouts 题解

    Content 给你 \(26\) 个字母的映射(都是小写,大写的映射方式相同),再给你一个字符串 \(s\),求它的映射结果(如果有非字母的字符保持不变). 数据范围:\(1\leqslant |s ...

  6. Fedora 22中的Locale and Keyboard Configuration

    Introduction The system locale specifies the language settings of system services and user interface ...

  7. OS X: Keyboard shortcuts

    Using keyboard shortcuts To use a keyboard shortcut, press a modifier key at the same time as a char ...

  8. Educational Codeforces Round 82 C. Perfect Keyboard

    Polycarp wants to assemble his own keyboard. Layouts with multiple rows are too complicated for him ...

  9. Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) Problem A - B

    Array of integers is unimodal, if: it is strictly increasing in the beginning; after that it is cons ...

随机推荐

  1. 【Cocos2d-x 3.0】游戏开发之win32配置环境搭建project

    作者:Senlern 转载请注明,原文链接:http://blog.csdn.net/zhang429350061/article/details/37958275 非常久没有写教程了.如今认为还是要 ...

  2. 设计模式之Flyweight模式(笔记)

    享元模式:运用共享技术有效地支持大量细粒度的对象. 适用场合:假设一个应用程序适用了大量的对象.而大量的这些对象造成了非常大的存储开销时就应该考虑使用. 首先定义一个IFlyweight接口 publ ...

  3. RvmTranslator6.6 - RVM to CATIA

    RvmTranslator6.6 - RVM to CATIA eryar@163.com RvmTranslator can translate the RVM file exported by A ...

  4. 推荐一款优雅的jquery手风琴特效

    推荐一款基于 jQuery和 CSS3实现的手风琴效果. 查看demo演示

  5. 线程池系列一:线程池作用及Executors方法讲解

    线程池的作用: 线程池作用就是限制系统中执行线程的数量.     根据系统的环境情况,可以自动或手动设置线程数量,达到运行的最佳效果:少了浪费了系统资源,多了造成系统拥挤效率不高.用线程池控制线程数量 ...

  6. Lesson 2 Building your first web page: Part 2

    Tag Diagram You may have noticed that HTML tags come in pairs; HTML has both an opening tag (<tag ...

  7. HDU 5358 First One 数学+尺取法

    多校的题,摆明了数学题,但是没想出来,蠢爆了,之前算了半天的s[i][j]的和,其实是积.其实比赛的时候我连log(s[i][j])+1是s[i][j]的位数都没看出来,说出来都丢人. 知道了这个之后 ...

  8. spring-cloud导入eclipse时,@slf4j注解为什么找不到log变量

    原因是缺少插件Lomboz. Lomboz是一个基于LGPL的开源J2EE综合开发环境的Eclipse插件,对编码,发布,测试,以及debug等各个软件开发的生命周期提供支持,支持JSP,EJB等.L ...

  9. Oracle数据库IP访问限制(IP白名单黑名单)

    1.编辑sqlnet.ora 内容为: #允许访问的IP(白名单) TCP.INVITED_NODES=(127.0.0.1,192.168.56.109,ip2,ip3,..,..本地IP..)若使 ...

  10. Flex4之事件详解

    第一.Flex事件简介 事件贯穿于Flex应用开发的全过程.事件是ActionScript .0中最重要的部分之一,也是Flex应用程序开发的核心基础.本章将在DOM 3的基础上详细讲解ActionS ...