CF-831B
B. Keyboard Layoutstime limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard 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.
InputThe 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.
OutputPrint the text if the same keys were pressed in the second layout.
Examplesinputqwertyuiopasdfghjklzxcvbnm
veamhjsgqocnrbfxdtwkylupzi
TwccpQZAvb2017outputHelloVKCup2017inputmnbvcxzlkjhgfdsapoiuytrewq
asdfghjklqwertyuiopzxcvbnm
7abaCABAABAcaba7output7uduGUDUUDUgudu7
题意:
输出用a敲出c的顺序敲b会产生的字符串
注意大小写转换
AC代码:
#include<bits/stdc++.h>
using namespace std; int main(){
char s1[],s2[],s3[];
cin>>s1>>s2>>s3;
char s4[];
for(int i=;i<;i++){
s4[s1[i]]=s2[i];
}
// cout<<s4['t']<<endl;
int len=strlen(s3);
for(int i=;i<len;i++){
if(s3[i]>='a'&&s3[i]<='z'){
s3[i]=s4[s3[i]];
}
else if(s3[i]>='A'&&s3[i]<='Z'){
s3[i]=s4[s3[i]-'A'+'a']-'a'+'A';
}
}
cout<<s3<<endl;
return ;
}
CF-831B的更多相关文章
- ORA-00494: enqueue [CF] held for too long (more than 900 seconds) by 'inst 1, osid 5166'
凌晨收到同事电话,反馈应用程序访问Oracle数据库时报错,当时现场现象确认: 1. 应用程序访问不了数据库,使用SQL Developer测试发现访问不了数据库.报ORA-12570 TNS:pac ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
- cf Round 613
A.Peter and Snow Blower(计算几何) 给定一个点和一个多边形,求出这个多边形绕这个点旋转一圈后形成的面积.保证这个点不在多边形内. 画个图能明白 这个图形是一个圆环,那么就是这个 ...
- ARC下OC对象和CF对象之间的桥接(bridge)
在开发iOS应用程序时我们有时会用到Core Foundation对象简称CF,例如Core Graphics.Core Text,并且我们可能需要将CF对象和OC对象进行互相转化,我们知道,ARC环 ...
- [Recommendation System] 推荐系统之协同过滤(CF)算法详解和实现
1 集体智慧和协同过滤 1.1 什么是集体智慧(社会计算)? 集体智慧 (Collective Intelligence) 并不是 Web2.0 时代特有的,只是在 Web2.0 时代,大家在 Web ...
- CF memsql Start[c]UP 2.0 A
CF memsql Start[c]UP 2.0 A A. Golden System time limit per test 1 second memory limit per test 256 m ...
- CF memsql Start[c]UP 2.0 B
CF memsql Start[c]UP 2.0 B B. Distributed Join time limit per test 1 second memory limit per test 25 ...
- CF #376 (Div. 2) C. dfs
1.CF #376 (Div. 2) C. Socks dfs 2.题意:给袜子上色,使n天左右脚袜子都同样颜色. 3.总结:一开始用链表存图,一直TLE test 6 (1)如果需 ...
- CF #375 (Div. 2) D. bfs
1.CF #375 (Div. 2) D. Lakes in Berland 2.总结:麻烦的bfs,但其实很水.. 3.题意:n*m的陆地与水泽,水泽在边界表示连通海洋.最后要剩k个湖,总要填掉多 ...
- CF #374 (Div. 2) D. 贪心,优先队列或set
1.CF #374 (Div. 2) D. Maxim and Array 2.总结:按绝对值最小贪心下去即可 3.题意:对n个数进行+x或-x的k次操作,要使操作之后的n个数乘积最小. (1)优 ...
随机推荐
- javacript中apply和call的区别
apply:方法能劫持另外一个对象的方法,继承另外一个对象的属性. 接受的参数是一个字符串. call:和apply的意思一样,只不过是参数列表不一样. 接收的参数是一个数组. 例如: <s ...
- Nouveau源代码分析(三):NVIDIA设备初始化之nouveau_drm_probe
Nouveau源代码分析(三) 向DRM注冊了Nouveau驱动之后,内核中的PCI模块就会扫描全部没有相应驱动的设备,然后和nouveau_drm_pci_table对比. 对于匹配的设备,PCI模 ...
- linux find prune排除某目录或文件
http://blog.csdn.net/ysdaniel/article/details/7995681 查找cache目录下不是html的文件 find ./cache ! -name '*.ht ...
- SWIM接口及STM8烧录过程
1. 硬件连接 SWIM接口只需要一根传输线,即可完成双向的传输.传输过程,都是由主控制端(host)发起,设备端然后做出反应.host端需要在一个总线上实现读和写,那就是说必须要同时接一个输出IO和 ...
- POJ 3469(Dual Core CPU-最小割)[Template:网络流dinic V2]
Language: Default Dual Core CPU Time Limit: 15000MS Memory Limit: 131072K Total Submissions: 19321 ...
- ubuntu 16.04 更新 gcc/g++ 4.9.2
ubuntu 转载 2016年10月12日 :: 标签:ubuntu /g++ /gcc [html] view plain copy sudo dpkg -l g++ 最近在学C++primer , ...
- 解决怎样监听Activity切换
本篇博文在我之前的博文中已经提到了,可是监听Activity切换又能够作为一个单独的内容来叙述,因此这里又单独拿了出来进行赘述. Activity的切换无非有两种.第一种:启动或者创建一个新的Acti ...
- 隐私问题成O2O绊脚石,加强行业监管迫在眉睫
这年头,O2O的发展越来越给力了.因为O2O能充分结合互联网经济的线上优势和传统经济的线下优势,因此,传统商户纷纷借助O2O来开展业务,取得了不俗的成绩.只是,在移动互联网越来越"开 ...
- Bullet Physics OpenGL 刚体应用程序模板 Rigid Simulation in Bullet
利用Bullet物理引擎实现刚体的自由落体模拟的模板 Bullet下载地址 Main.cpp #include <GLUT/glut.h> #include <cstdlib> ...
- Erlang Shell调试网络程序真方便
Erlang的shell功能强大,这里我将它当成我的客户端.可以动态的输入你需要发送的内容,也可以动态的接收内容,就像调试器一样,在开发过程中起到很重要的作用.具体使用方式如下: C:\Documen ...