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
题目的意思是给出26个字母对应变化表,求给定串变化后的结果
思路:搞个map hash一下
#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的更多相关文章

  1. Codeforces Round #424 B. Keyboard Layouts(字符串,匹配,map)

    #include <stdio.h> #include <string.h> ][]; ]; ]; int main(){ scanf(]); scanf(]); scanf( ...

  2. Codefroces 831B Keyboard Layouts

    B. Keyboard Layouts time limit per test 1 second memory limit per test 256 megabytes input standard ...

  3. codeforces 831B. Keyboard Layouts 解题报告

    题目链接:http://codeforces.com/contest/831/problem/B 题目意思:给出两个长度为26,由小写字母组成的字符串s1和s2,对于给出的第三个字符串s3,写出对应s ...

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

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

  5. CF831B Keyboard Layouts 题解

    Content 给你 \(26\) 个字母的映射(都是小写,大写的映射方式相同),再给你一个字符串 \(s\),求它的映射结果(如果有非字母的字符保持不变). 数据范围:\(1\leqslant |s ...

  6. Fedora 22中的Locale and Keyboard Configuration

    Introduction The system locale specifies the language settings of system services and user interface ...

  7. OS X: Keyboard shortcuts

    Using keyboard shortcuts To use a keyboard shortcut, press a modifier key at the same time as a char ...

  8. Educational Codeforces Round 82 C. Perfect Keyboard

    Polycarp wants to assemble his own keyboard. Layouts with multiple rows are too complicated for him ...

  9. 日文xp系统中 日文键盘模式转英式键盘模式

    键盘设备驱动早在Windows XP安装时就已经安装好了,但是系统却将日式键盘误识成了美式标准键盘,这会出现一些标点符号的实际输入与键盘标注不符的问题,对于用惯了英文键盘的人可 以盲打而不去理会,但对 ...

随机推荐

  1. 解决访问HTTPS,抛出的异常javax.net.ssl.SSLHandshakeException

    本地测试没问题,http换成https抛出异常javax.net.ssl.SSLHandshakeException,网上有说是服务器证书,有说要启动SSL3协议的,反正没有找到有用的. 在GET和P ...

  2. linux上安装Docker

    https://blog.csdn.net/qq_36892341/article/details/73918672

  3. 【Spring】SpringMVCの環境構築(簡)(Version3.1)

    ■Mavenでプロジェクトの新規 ■プロジェクトのイメージ ■必要なラブリア ■ソース ①pom.xml <?xml version="1.0" encoding=" ...

  4. 【相关网站 - 02】- Java 好文博客

    一.源码分析博客 还有这种操作?浅析为什么要看源码 你觉得什么才是 Java 的基础知识? 1. JDK 2. Mybatis 3. Spring 4. Sring Boot 5. Spring Cl ...

  5. 2018-2019-2 《Java程序设计》结对项目阶段总结《四则运算——整数》(二)

    20175218 2018-2019-2 <Java程序设计>结对项目阶段总结<四则运算--整数> 一.需求分析 实现一个命令行程序,要求: 自动生成小学四则运算题目(加,减, ...

  6. LAB12 Transaction

    思路:就是把aotocommit()里面的东西改改就行了. 查询要求可用房间>=所需要的房间. SQL里面查数字时,不要加单引号.字符串才要. 查询里的set ONHAND=要改成自己的变量名s ...

  7. HashTable和HashMap的区别详解(转)

    一.HashMap简介 HashMap是基于哈希表实现的,每一个元素是一个key-value对,其内部通过单链表解决冲突问题,容量不足(超过了阀值)时,同样会自动增长. HashMap是非线程安全的, ...

  8. MongoDB设置连接池操作百万级以上数据

    开发环境 spring 4.3.7 + springBoot 1.5.2 + dubbo 2.6.5 + mongoDB 4.0.0 连接池配置 mongo-pool.properties sprin ...

  9. oracle自带总页数分页sql

    string strSQL = string.Format(@"select * from( with temp as (select * from * where {0} order by ...

  10. Oracle启动和停止

    概述 只有具备sysdba和sysoper系统特权的用户才能启动和关闭数据库. 在启动数据库之前应该启动监听程序,否则就不能利用命令方式来管理数据库,包括启动和关闭数据库. 虽然数据库正常运行,但如果 ...