Codefroces 831B 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
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的更多相关文章
- codeforces 831B. Keyboard Layouts 解题报告
题目链接:http://codeforces.com/contest/831/problem/B 题目意思:给出两个长度为26,由小写字母组成的字符串s1和s2,对于给出的第三个字符串s3,写出对应s ...
- Codeforces831B Keyboard Layouts
B. Keyboard Layouts time limit per test 1 second memory limit per test 256 megabytes input standard ...
- Codeforces Round #424 B. Keyboard Layouts(字符串,匹配,map)
#include <stdio.h> #include <string.h> ][]; ]; ]; int main(){ scanf(]); scanf(]); scanf( ...
- 【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 ...
- 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 ...
随机推荐
- Equals和==比較
总结一下: 对于字符串来说.两个比較的都是对象的值,而且是等效的,这是由于MS重写了==运算符和Equals方法所致 对于非字符串的其它引用类型(非匿名类型)两个比較的都是对象 ...
- Bitmap缓存机制
Bitmap缓存机制 载入一个bitmap到UI里面比較简单直接.可是,假设我们一次载入大量的bitmap数据的时候就变得复杂了.很多情况下(比方这些组件:ListVIew,GridView或者Vie ...
- webpack02
consumer-index.html <!DOCTYPE html> <html lang="en"> <head> <meta cha ...
- Visual Code的调试
Run 'Debug: Download .NET Core Debugger' in the Command Palette or open a .NET project directory to ...
- DNS隧道和工具
DNS Tunneling及相关实现 转自:http://www.freebuf.com/sectool/112076.html DNS Tunneling,是隐蔽信道的一种,通过将其他协议封装在DN ...
- Android自定义控件简单实现ratingbar效果
先上图: 一开始让我自定义控件我是拒绝的,因为android很早以前就有一个控件ratingbar,但是设置样式的时候我发现把图片设置小一点就显示不全,一直找不到解办法!(可以设置系统的自带的小样式) ...
- Hexo Daemon
前提 今天中午的时候发现自已网站突然不能访问了,我猜肯定是后台的hexo服务异常自动kill掉了.果然登录服务器ps -ef | grep hexo查看进程,果然发现hexo的进程不在了.由于我将输出 ...
- 最长上升子序列(LIS)nlogn模板
参考https://www.cnblogs.com/yuelian/p/8745807.html 注意最长上升子序列用lower_bound,最长不下降子序列用upper_bound 比如123458 ...
- iOS 开发之IPad的设计与实现
// // main.m // 6-ipad // #import <Foundation/Foundation.h> #import "Ipad.h" int mai ...
- 1.6 INSERT语句
1.6 INSERT语句正在更新内容,请稍后