#include <stdio.h>
#include <string.h> char ch[][];
char t[]; int num[]; int main(){
scanf("%s",ch[]);
scanf("%s",ch[]);
scanf("%s",t); for(int i=;i<strlen(ch[]);i++){
num[ch[][i]-'a']=i;
} for(int i=;i<strlen(t);i++){
if(<=t[i]-''&&t[i]-''<=){
printf("%c",t[i]);
}else if('a'<=t[i]&&t[i]<='z'){
printf("%c",ch[][num[t[i]-'a']]);
}else if('A'<=t[i]&&t[i]<='Z'){
printf("%c",ch[][num[t[i]-'A']]-);
} }
printf("\n");
return ;
}

 #include <stdio.h>
#include <string.h>
char key[];
int main ()
{
char b,f[],l[],sent[];
int i,j,x;
scanf("%s",f);
scanf("%s",l);
scanf("%s",sent);
for(i=;i<;i++)
{
key[f[i]]=l[i];
key[f[i]-]=l[i]-;
}
for(i=;i<strlen(sent);i++)
{
if(key[sent[i]])
printf("%c",key[sent[i]]);
else
{ printf("%c",sent[i]);
}
}
return ; }
 #include<stdio.h>

 int main()
{
char a[],b[],ch;
int i=;
while((a[i]=getchar())!='\n') i++;
i=;
while((b[i]=getchar())!='\n') i++;
while((ch=getchar())!='\n')
{
if(ch<) printf("%c",ch);
else if(ch<)
{
ch+=;
for(i=;i<;i++)
if(a[i]==ch)
{
printf("%c",b[i]-);
break;
}
}
else
for(i=;i<;i++)
if(a[i]==ch)
{
printf("%c",b[i]);
break;
}
}
return ;
}
 #include <bits/stdc++.h>
using namespace std; int main()
{
char a[],c;
int i;
string s1,s2,s;
cin>>s1>>s2>>s;
for(i=;i<;++i)
a[s1[i]]=s2[i];
for(i=;i<s.length();++i)
{
if(s[i]>=&&s[i]<=)
{
c=s[i]+;
s[i]=a[c]-;
}
else if(s[i]>=&&s[i]<=)
{
s[i]=a[s[i]];
}
}
cout<<s;
return ;
}
 #include<cstdio>
#include<cstring>
#include<iostream>
using namespace std; char s1[],s2[],ch[],s[];
int len; int main()
{
scanf("%s%s%s",s1,s2,s);
for(int i=;i<=;i++)
{
ch[s1[i]]=s2[i];
}
len=strlen(s);
for(int i=;i<len;i++)
{
if(s[i]>='A'&&s[i]<='Z')
{
s[i]+=;
s[i]=ch[s[i]]-;
}
else if(s[i]>='a'&&s[i]<='z')
s[i]=ch[s[i]];
else
s[i]=s[i];
}
printf("%s\n",s);
return ;
}
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

Codeforces Round #424 B. Keyboard Layouts(字符串,匹配,map)的更多相关文章

  1. Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals)

    http://codeforces.com/contest/831 A. Unimodal Array time limit per test 1 second memory limit per te ...

  2. 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 ...

  3. Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) A 水 B stl C stl D 暴力 E 树状数组

    A. Unimodal Array time limit per test 1 second memory limit per test 256 megabytes input standard in ...

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

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

  5. Codeforces Round #410 (Div. 2)(A,字符串,水坑,B,暴力枚举,C,思维题,D,区间贪心)

    A. Mike and palindrome time limit per test:2 seconds memory limit per test:256 megabytes input:stand ...

  6. Codeforces Round #548 (Div. 2) E 二分图匹配(新坑) or 网络流 + 反向处理

    https://codeforces.com/contest/1139/problem/E 题意 有n个学生,m个社团,每个学生有一个\(p_i\)值,然后每个学生属于\(c_i\)社团, 有d天,每 ...

  7. Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals)A,B,C

    A:链接:http://codeforces.com/contest/831/problem/A 解题思路: 从前往后分别统计递增,相等,递减序列的长度,如果最后长度和原序列长度相等那么就输出yes: ...

  8. Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) Problem D (Codeforces 831D) - 贪心 - 二分答案 - 动态规划

    There are n people and k keys on a straight line. Every person wants to get to the office which is l ...

  9. Codeforces Round #541 (Div. 2) E 字符串 + 思维 + 猜性质

    https://codeforces.com/contest/1131/problem/D 题意 给你n个字符串,字符串长度总和加起来不会超过1e5,定义字符串相乘为\(s*s1=s1+s[0]+s1 ...

随机推荐

  1. elasticsearch-1.7.1 (es Windows 64)

    elasticsearch-1.7.1 (es Windows 64) https://blog.csdn.net/qq_27093465/article/details/53544541 elast ...

  2. Word2010 自动生成二级编号

    http://jingyan.baidu.com/article/3ea5148901919752e61bbafe.html

  3. [Leetcode] Interger to roman 整数转成罗马数字

    Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 t ...

  4. git使用笔记(七)版本回退和撤销

    By francis_hao    Nov 21,2016 从版本库初始化开始,每一步的撤销操作 添加第一个文件 在空的版本库中创建了一个文件并git add到了缓存区,这时候怎么撤销呢? 撤销单个文 ...

  5. BZOJ1001:狼抓兔子(最小割最大流+vector模板)

    1001: [BeiJing2006]狼抓兔子 Description 现在小朋友们最喜欢的"喜羊羊与灰太狼",话说灰太狼抓羊不到,但抓兔子还是比较在行的,而且现在的兔子还比较笨, ...

  6. 在Ubuntu下编译WebKit源码--qt

    转载自:http://www.cnblogs.com/panderen/archive/2011/10/18/2216154.html 在朋友的介绍下有幸認识了WebKit这个让人心动的开源浏览器内核 ...

  7. Springmvc 流程图

  8. nginx的常规配置

    程序员们,在北上广你还能买房吗? >>>   nginx的常规配置 nginx的使用非常简单,只需要配置好我们需要的各种指令,就能跑起来.如果你需要添加模块,还需要添加模块方面的配 ...

  9. bzoj1862: [Zjoi2006]GameZ游戏排名系统

    Description GameZ为他们最新推出的游戏开通了一个网站.世界各地的玩家都可以将自己的游戏得分上传到网站上.这样就可以看到自己在世界上的排名.得分越高,排名就越靠前.当两个玩家的名次相同时 ...

  10. POJ1061-青蛙的约会---扩展欧几里德算法求最小整数解

    扩展欧几里得算法模板 #include <cstdio> #include <cstring> #define ll long long using namespace std ...