Codeforces831B Keyboard Layouts
1 second
256 megabytes
standard input
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.
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.
Print the text if the same keys were pressed in the second layout.
qwertyuiopasdfghjklzxcvbnm
veamhjsgqocnrbfxdtwkylupzi
TwccpQZAvb2017
HelloVKCup2017
mnbvcxzlkjhgfdsapoiuytrewq
asdfghjklqwertyuiopzxcvbnm
7abaCABAABAcaba7
7uduGUDUUDUgudu7
#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的更多相关文章
- Codeforces Round #424 B. Keyboard Layouts(字符串,匹配,map)
#include <stdio.h> #include <string.h> ][]; ]; ]; int main(){ scanf(]); scanf(]); scanf( ...
- Codefroces 831B Keyboard Layouts
B. Keyboard Layouts time limit per test 1 second memory limit per test 256 megabytes input standard ...
- codeforces 831B. Keyboard Layouts 解题报告
题目链接:http://codeforces.com/contest/831/problem/B 题目意思:给出两个长度为26,由小写字母组成的字符串s1和s2,对于给出的第三个字符串s3,写出对应s ...
- 【Codeforces Round #424 (Div. 2) B】Keyboard Layouts
[Link]:http://codeforces.com/contest/831/problem/B [Description] 两个键盘的字母的位置不一样; 数字键的位置一样; 告诉你第一个键盘按某 ...
- CF831B Keyboard Layouts 题解
Content 给你 \(26\) 个字母的映射(都是小写,大写的映射方式相同),再给你一个字符串 \(s\),求它的映射结果(如果有非字母的字符保持不变). 数据范围:\(1\leqslant |s ...
- Fedora 22中的Locale and Keyboard Configuration
Introduction The system locale specifies the language settings of system services and user interface ...
- OS X: Keyboard shortcuts
Using keyboard shortcuts To use a keyboard shortcut, press a modifier key at the same time as a char ...
- Educational Codeforces Round 82 C. Perfect Keyboard
Polycarp wants to assemble his own keyboard. Layouts with multiple rows are too complicated for him ...
- 日文xp系统中 日文键盘模式转英式键盘模式
键盘设备驱动早在Windows XP安装时就已经安装好了,但是系统却将日式键盘误识成了美式标准键盘,这会出现一些标点符号的实际输入与键盘标注不符的问题,对于用惯了英文键盘的人可 以盲打而不去理会,但对 ...
随机推荐
- .net MVC简洁的登录页面
初学mvc,参考别人的代码写的 界面效果如下: 代码如下: @{ Layout = null; } <!DOCTYPE html> <html> <head> &l ...
- QT Designer基础——登录界面设计基础版
认识QT Designer提供的可选控件:以下八个大类 Layouts:布局相关 Spacers:留空 Buttons:可点击的按钮类 Item Views和 Item Widgets:高级控件,例如 ...
- Hillstone设备管理-设备软件Stone-OS升级
1.通过sysloader进行StoneOS升级 1)给设备上电按提示按ESC并且进入 Sysloader.参照以下操作提示: 2)在下面选择对应的选项升级os,可以通过tftp.ftp.usb.系统 ...
- java 基础 ----- Arrays 工具类
----- Arrays 工具类是一个比较方便的类 常用的方法 也可以通过jdk文档进行查看 右侧有偶 对一些比较常用的方法进行演示 直接放在main方法中进行测试 ---- equ ...
- nginx学习笔记(二)
nginx变量 Nginx 变量值容器的生命期是与当前正在处理的请求绑定的,而与 location 无关. 通过 set 指令隐式创建的 Nginx 变量.这些变量我们一般称为"用户自定义变 ...
- Kafka的安装及与Spring Boot的集成
安装JDK 下载jdk-8u202-ea-bin-b03-linux-x64-07_nov_2018.tar.gz 解压 配置 $ vi /etc/profile,在最后加入下面两行 export J ...
- 探索未知种族之osg类生物---渲染遍历之裁剪一
前言 上面我们用了四节课的内容,讲解了一些osg概念性的内部原理.希望大家可以再看今天的讲解之前先再仔细的研究一下前四节的内容.这样你就会对整个osg的渲染过程有一个更加清晰的认知,有助于理解下面两个 ...
- swift 实现拍照 选择相册
//点击按钮的方法 func photos() { self.showBottomAlert() } /// 屏幕底部弹出的Alert func showBottomAlert(){ let aler ...
- douyin-bot-代码
# -*- coding: utf-8 -*- import sys import random import time from PIL import Image if sys.version_in ...
- Linux 远程工具Screen 的应用
挂断原理参考:https://www.ibm.com/developerworks/cn/linux/l-cn-screen/ 要求,python2 常用操作: 创建screen screen -L ...