Content

给你 \(26\) 个字母的映射(都是小写,大写的映射方式相同),再给你一个字符串 \(s\),求它的映射结果(如果有非字母的字符保持不变)。

数据范围:\(1\leqslant |s|\leqslant 1000\)。

Solution

强大的 \(\texttt{map}\) 正好能够为我们做出映射的功能,我们直接存储每个字母的映射再直接将原字符串映射即可。

Code

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <cstring>
#include <map>
using namespace std; string a, b, c;
map<char, char> mm; int main() {
cin >> a >> b;
int len = a.size();
for(int i = 0; i < len; ++i) mm[a[i]] = b[i], mm[a[i] - 32] = b[i] - 32;
cin >> c;
len = c.size();
for(int i = 0; i < len; ++i)
if((c[i] >= 'a' && c[i] <= 'z') || (c[i] >= 'A' && c[i] <= 'Z'))
c[i] = mm[c[i]];
cout << c;
return 0;
}

CF831B Keyboard Layouts 题解的更多相关文章

  1. Codeforces831B Keyboard Layouts

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

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

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

  3. Codefroces 831B Keyboard Layouts

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

  4. CF1238E.Keyboard Purchase 题解 状压/子集划分DP

    作者:zifeiy 标签:状压DP,子集划分DP 题目链接:https://codeforces.com/contest/1238/problem/E 题目大意: 给你一个长度为 \(n(n \le ...

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

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

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

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

  7. Fedora 22中的Locale and Keyboard Configuration

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

  8. OS X: Keyboard shortcuts

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

  9. CF-831B

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

随机推荐

  1. 掌握Java的内存模型,你就是解决并发问题最靓的仔

    摘要:如果编写的并发程序出现问题时,很难通过调试来解决相应的问题,此时,需要一行行的检查代码,这个时候,如果充分理解并掌握了Java的内存模型,你就能够很快分析并定位出问题所在. 本文分享自华为云社区 ...

  2. asList和subList的缺陷

    概述 在开发中我们经常使用asList去把一个数组转换为List.也存在通过subList.subMap.来对List.Map.Set来进行类似使用subString方法来对String对象进行分割处 ...

  3. Docker之容器化学习之路v20.10.3

    Docker概述 **本人博客网站 **IT小神 www.itxiaoshen.com Docker文档官网 Docker是一个用于开发.发布和运行应用程序的开放平台.Docker使您能够将应用程序与 ...

  4. .NET 5的System.Text.Json的JsonDocument类讲解

    本文内容来自我写的开源电子书<WoW C#>,现在正在编写中,可以去WOW-Csharp/学习路径总结.md at master · sogeisetsu/WOW-Csharp (gith ...

  5. 24:WEB漏洞-文件上传之WAF绕过及安全修复

    本课重点 案例1:上传数据包参数对应修改测试 案例2:safedog+云服务器+uploadlabs测试 案例3:safedog+云服务器+uploadlabs_fuzz测试 案例4:文件上传安全修复 ...

  6. c语言实参与形参的区别

    1 #include<stdio.h> 2 #include<math.h> 3 4 /** 5 * 形参和实参的功能是作数据传送. 6 * 函数调用中发生的数据传送是单向的. ...

  7. [NOI2020] 超现实树

    我们定义链树为:在该树上的任意节点,左右子树大小的最小值小于2. 举个例子: 那么我们思考,链树显然可以在叶子节点任意替换成其他子树. 那么在主链上,我们可以做到生成任意深度大于主链长度的树. 反过来 ...

  8. jumpserver——脚本安装

    CentOS Linux release 7.7.1908 (Core) 3.10.0-1062.4.1.el7.x86_64 Initialize(){ yum update -y systemct ...

  9. Web网页服务器软件——介绍

    Web网页服务器软件与硬件服务器的关系,就像软件和电脑的关系. 目前有,世界使用排列第一名的Apache.还有可以在Linux系统下快速方便地搭建出LNMP Web服务环境的Nginx(其中LNMP分 ...

  10. kubernetes部署kube-scheduler服务

    同样的分非认证授权和认证授权: 非认证授权: cat > /lib/systemd/system/kube-scheduler.service <<EOF [Unit] Descri ...