codeforces 831B Keyboard Layouts
来源:互联网 发布:高斯步枪 知乎 编辑:程序博客网 时间:2024/06/17 20:38
点击打开链接
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.
qwertyuiopasdfghjklzxcvbnmveamhjsgqocnrbfxdtwkylupziTwccpQZAvb2017
HelloVKCup2017
mnbvcxzlkjhgfdsapoiuytrewqasdfghjklqwertyuiopzxcvbnm7abaCABAABAcaba7
7uduGUDUUDUgudu7
#include<iostream>#include<cstdio>#include<cstring>using namespace std;int main(){ char a[30],b[30]; char s[1005]; scanf("%s%s%s",a,b,s); int i,j,len=strlen(s); for(i=0; i<len; i++) { if(s[i]>='0'&&s[i]<='9') cout<<s[i]; else { if(s[i]>='a'&&s[i]<='z') { for(j=0; j<26; j++) { if(a[j]==s[i]) { cout<<b[j]; break; } } } else { s[i]+=32; for(j=0; j<26; j++) { if(a[j]==s[i]) { printf("%c",b[j]-32); break; } } } } } cout<<endl; return 0;}
- CodeForces 831B Keyboard Layouts
- Codeforces 831 B Keyboard Layouts
- CodeForces 831B-Keyboard Layouts
- codeforces 831B Keyboard Layouts
- CodeForces 831 B.Keyboard Layouts(水~)
- CodeFroces 831B. Keyboard Layouts(构造题)
- cf424div2 B. Keyboard Layouts
- Codeforces831 B. Keyboard Layouts
- B. Keyboard Layouts
- Codeforces Round #424 (Div. 2) B. Keyboard Layouts(字符串)
- Codeforces Round #424 (Div. 2) B. Keyboard Layouts
- Codeforces Round #424 (Div. 2) B. Keyboard Layouts
- Codeforces Round #424 (Div. 2) B Keyboard Layouts 思维题 字符串处理
- Codeforces Round #424 (Div. 2) B. Keyboard Layouts(字符串处理)
- Keyboard Layouts
- Codeforces #831B: Keyboard Layout 题解
- codeforces.831BKeyboard Layouts
- CF831B-Keyboard Layouts
- 线段树模板
- python入门(二十六):基于反射模拟Web框架路由系统
- 大数据生态系统基础:Hadoop(五):Hadoop 3.0.0 HDFS读写及编程基础
- Python
- Java_18 File类
- codeforces 831B Keyboard Layouts
- 关于java中byte的相关问题
- js与Jquery的区别是什么?
- SQL Server 学习笔记之Collation(校对)
- 一周科技要闻
- 关于醉驾的想去没去成,去了没撞人,去了撞了,该受到怎样的谴责的理由
- QNX系统的ftp调试,连接FTP调试-QNX的PC104调试ftp
- BZOJ[1455]罗马游戏 可并堆
- 竞赛题目讲解-【Central Europe 1996】装箱问题