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

时间:2022-09-15 12:58:42

 #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 &num;424 &lpar;Div&period; 2&comma; rated&comma; based on VK Cup Finals&rpar;

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

  2. Codeforces Round &num;424 &lpar;Div&period; 2&comma; rated&comma; based on VK Cup Finals&rpar; Problem A - B

    Array of integers is unimodal, if: it is strictly increasing in the beginning; after that it is cons ...

  3. Codeforces Round &num;424 &lpar;Div&period; 2&comma; rated&comma; based on VK Cup Finals&rpar; 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 &num;424 &lpar;Div&period; 2&rpar; B】Keyboard Layouts

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

  5. Codeforces Round &num;410 &lpar;Div&period; 2&rpar;&lpar;A&comma;字符串&comma;水坑,B&comma;暴力枚举,C&comma;思维题,D&comma;区间贪心&rpar;

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

  6. Codeforces Round &num;548 &lpar;Div&period; 2&rpar; E 二分图匹配&lpar;新坑&rpar; or 网络流 &plus; 反向处理

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

  7. Codeforces Round &num;424 &lpar;Div&period; 2&comma; rated&comma; based on VK Cup Finals&rpar;A&comma;B&comma;C

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

  8. Codeforces Round &num;424 &lpar;Div&period; 2&comma; rated&comma; based on VK Cup Finals&rpar; Problem D &lpar;Codeforces 831D&rpar; - 贪心 - 二分答案 - 动态规划

    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 &num;541 &lpar;Div&period; 2&rpar; E 字符串 &plus; 思维 &plus; 猜性质

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

随机推荐

  1. HDU 3341 Lost&&num;39&semi;s revenge(AC自动机&plus;DP)

    Lost's revenge Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)T ...

  2. 加了GO后报 &&num;39&semi;GO&&num;39&semi; 附近有语法错误

    单独运行SQL无问题,了加GO就报错. 是你的SQL语句中,有些行的结尾处只有Char(13)没有Char(10),即:只有回车符没有换行符,这种状态在视觉上是没办法区分的. 参考:http://ww ...

  3. 平时的笔记04:处理stagger模块

    #! /usr/bin/env python3 # # __init__.py # From the stagger project: http://code.google.com/p/stagger ...

  4. china-pub

    #!/usr/bin/env python                         #coding:utf-8import urllib2,re,sys,os,types            ...

  5. 学生成绩管理C&plus;&plus;版

    [标题]学生成绩管理的设计与实现 [开发语言]C++ [主要技术]STL [概要设计]类名:student 类成员:No.Name.Math.Eng.Chn.Cpro.Sum 成员函数:getname ...

  6. 22&period;1 、react生命周期&lpar;一&rpar;

    在每个react组件中都有以下几个生命周期方法~我们需要在不同阶段进行讨论 组件生命周期概述 1.初始化 在组件初始化阶段会执行 constructor static getDerivedStateF ...

  7. python爬取百度贴吧帖子

    最近偶尔学下爬虫,放上第二个demo吧 #-*- coding: utf-8 -*- import urllib import urllib2 import re #处理页面标签类 class Too ...

  8. 学以致用十七-----shell脚本之比较数字和字符串及if else

    非常需要注意的是shell脚本对空格要求非常严格, 如: 比较字符串   (不能用于比较字符串) 以上这种写法会报错 因此比较字符串不用 单中括号 [ ] -----------------有误 而是 ...

  9. OpenCV——ROI截取、线性混合、通道分离、合并、亮度对比度调整

    #include <opencv2/opencv.hpp> #include <iostream> using namespace cv; using namespace st ...

  10. Linux:split命令详解

    split 可以将一个大文件分割成很多个小文件,有时需要将文件分割成更小的片段,比如为提高可读性,生成日志 语法 split(选项)(file)PREFIX 选项 -b:值为每一输出档案的大小,单位为 ...