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
题目的意思是给出26个字母对应变化表,求给定串变化后的结果
思路:搞个map hash一下
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <vector>
#include <bitset> using namespace std; #define LL long long
const int INF = 0x3f3f3f3f;
#define MAXN 2000010 map<char,char>mp; char a[10005],b[10005],c[10005]; int main()
{
scanf("%s",a);
scanf("%s",b);
scanf("%s",c);
int k1=strlen(a);
for(int i=0;i<k1;i++)
{
mp[a[i]]=b[i];
}
int k2=strlen(c);
for(int i=0;i<k2;i++)
{
if(c[i]>='a'&&c[i]<='z')
printf("%c",mp[c[i]]);
else if(c[i]>='A'&&c[i]<='Z')
printf("%c",mp[c[i]+'a'-'A']-'a'+'A');
else
printf("%c",c[i]);
}
printf("\n");
return 0;
}

Codeforces831B Keyboard Layouts的更多相关文章

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

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

  2. Codefroces 831B Keyboard Layouts

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

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

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

  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. 日文xp系统中 日文键盘模式转英式键盘模式

    键盘设备驱动早在Windows XP安装时就已经安装好了,但是系统却将日式键盘误识成了美式标准键盘,这会出现一些标点符号的实际输入与键盘标注不符的问题,对于用惯了英文键盘的人可 以盲打而不去理会,但对 ...

随机推荐

  1. 聚宽获取财务数据+DataFrame写入txt

    from jqdata import jy from jqdata import * #获取股票列表,这里是板块内股票 pool=get_industry_stocks(',date='2016-09 ...

  2. Django Rest Framework 视图和路由

    Django Rest Framework 视图和路由   DRF的视图 APIView 我们django中写CBV的时候继承的是View,rest_framework继承的是APIView,那么他们 ...

  3. 2018-2019-2 20175218 实验二《Java面向对象程序设计》实验报告

    2018-2019-2 20175218 实验二<Java面向对象程序设计>实验报告 一.面向对象程序设计-1 1.实验要求 参考 http://www.cnblogs.com/roced ...

  4. OSPFv3综合实验(GNS3)

    一.实验目的 1.  掌握 OSPFv3(v2) 的配置方法 2.  掌握在帧中继环境下 OSPFv3 (v2)的配置方法 3.  掌握 OSPFv3(v2) NSSA 的配置方法 4.  掌握外部路 ...

  5. code first , Migration

    文章引用至: https://www.cnblogs.com/panchunting/p/entity-framework-code-first-migrations.html 随着业务的增加, 之前 ...

  6. laravel5增删改查

    路由规则: 数据库配置: config/database.php laravel5/.env 控制器: 表单: 展示页面: 修改页面:

  7. 苹果手机input有圆角阴影的解决方法

    input[type=button], input[type=submit], input[type=file], button { cursor: pointer; -webkit-appearan ...

  8. java8 LocalDateTime转unix时间戳(带毫秒,不带毫秒)

    转载自:LocalDateTime To Timestamp Epoch Seconds And Milliseconds Convert LocalDateTime to seconds since ...

  9. Windows Server 2012 正式版/标准版/数据中心版安装序列号密钥

    Windows Server 2012(开发代号:Windows Server 8)是微软发布的一款服务器操作系统,也是Windows 8对应的服务器版本,属于是Windows Server 2008 ...

  10. SNORT入侵检测系统

    SNORT入侵检测系统 YxWa · 2015/10/09 10:38 0x00 一条简单的规则 alert tcp 202.110.8.1 any -> 122.111.90.8 80 (ms ...