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. .net MVC简洁的登录页面

    初学mvc,参考别人的代码写的 界面效果如下: 代码如下: @{ Layout = null; } <!DOCTYPE html> <html> <head> &l ...

  2. 走进MyBatis的世界

    1.MyBatis可框架及ORM 1.Mybatis框架简介 MyBatis是一个开源的数据持久层框架.它内部封装了通过了JDBC访问数据库的操作,支持普通的SQL查询,存储过程和高级映射,几乎消除了 ...

  3. activemq stomp类

    此库用来增强ide,能对stomp类进行自动提示 <?php class Stomp { /** * 构造器 * Stomp constructor. * @param string $brok ...

  4. STM32的命名规范

    STM32F407VET6 STM32F407代表的是芯片的型号后面的字符表示芯片的信息 V这一项代表引脚数,其中T代表36脚,C代表48脚,R代表64脚,V代表100脚,Z代表144脚,I代表176 ...

  5. 如何给php数组添加元素

    以参考下 本文较为详细的总结了php数组添加元素方法.分享给大家供大家参考.具体分析如下: 如果我们是一维数组增加数组元素我们可以使用ArrayListay_push,当然除这种方法之外我们还有更直接 ...

  6. Babel插件:@babel/plugin-transform-runtime

    一 概述 每个Babel编译后的脚本文件,都以导入的方式使用Babel的帮助函数,而不是每个文件都复制一份帮助函数的代码. 1 优点 (1)提高代码重用性,缩小编译后的代码体积. (2)防止污染全局作 ...

  7. vue根据路由变换,切换导航栏样式

    <ul> <li> <router-link :to="{name: 'home'}" class="active_item" e ...

  8. 项目总结20:阿里云免费https证书申请

    项目总结20:阿里云免费https证书申请 1. 登录阿里云控制台 www.aliyun.com,用账户信息登录 2. 在”产品与服务”搜索SSL,选择SSL证书 3. 点击购买证书 4. 选择” S ...

  9. formValidator 插件 使用总结

    1. 大小写的问题, formvalidator 的属性 大小写问题一定要注意, 在踩过的坑里就包括这个, 把所有属性的第二个字母的开头全部写成大写 ,导致提示信息不能用,这个问题纠结了好久 2.er ...

  10. charles修改接口返回值

    我们在测试app时,如果想看大数据量的展示情况,可以通过charles修改接口返回值来实现. 步骤1:手机连接代理 步骤2:app端请求接口,查看charles抓包情况 步骤3:选择想要修改返回值的接 ...