当前位置:网站首页>PAT乙级-B1029 旧键盘(20)
PAT乙级-B1029 旧键盘(20)
2022-08-08 05:54:00 【nekoha_dexter】
旧键盘上坏了几个键,于是在敲一段文字的时候,对应的字符就不会出现。现在给出应该输入的一段文字、以及实际被输入的文字,请你列出肯定坏掉的那些键。
输入格式:
输入在 2 行中分别给出应该输入的文字、以及实际被输入的文字。每段文字是不超过 80 个字符的串,由字母 A-Z(包括大、小写)、数字 0-9、以及下划线 _(代表空格)组成。题目保证 2 个字符串均非空。
输出格式:
按照发现顺序,在一行中输出坏掉的键。其中英文字母只输出大写,每个坏键只输出一次。题目保证至少有 1 个坏键。
输入样例:
7_This_is_a_test
_hs_s_a_es
输出样例:
7TI
#include<iostream>
#include<string>
using namespace std;
bool check[257];//检查是否已检查过了
int main(){
string text, str;
cin >> text;
//将所有小写转化为大写
for(int i = 0; i < text.size(); ++i){
if(text[i] >= 'a' && text[i] <= 'z')
text[i] = text[i] - 'a'+'A';
}
cin >> str;
//同上
for(int i = 0; i < str.size(); ++i){
if(str[i] >= 'a' && str[i] <= 'z')
str[i] = str[i] - 'a' + 'A';
}
for(int i = 0 ; i < text.size(); ++i)
if(!check[text[i]]){//对于没有检查过的字符进行检查
if(str.find(text[i]) == -1) cout << text[i];
check[text[i]] = true;
}
return 0;
}
边栏推荐
- [Redis] Redis Learning - Transaction
- Use of Filter
- Educational Codeforces Round 133 (Rated for Div. 2) C补题
- VSCode已经设置过为中文但变成英文的解决办法
- Several postman features worth collecting will help you do more with less!
- And an array merge rank by rank
- 温故知新—Activity的五种启动模式
- webstorage
- 阿里云的数据库怎么提高访问速度的本地的打开的方式是www.zgysffm.com怎样的?
- uvm简介
猜你喜欢

Connect two tables to update the third table (updata) in postgresql

Integer block sample

Unity-CharacterController (Character Controller)

Style of DataGrid in wpf

Preprocessing Notes

Summary of digital IC design written test questions (4): some basic knowledge points

Object.prototype.toString()如何判断数据类型及注意点

Web 攻击的日志分析:初学者指南

cnn卷积神经网络反向传播,卷积神经网络维度变化

预处理笔记
随机推荐
线程使用、控制、通信
仿QQ好友列表,QListWidget!
Cs software UI building methods
Educational Codeforces Round 133 (Rated for Div. 2) C Supplement
并查集按秩合并rank数组
Several postman features worth collecting will help you do more with less!
《公共管理学》考试重点及答案
【图像处理】matlab基础图像处理 | 图像载入、图像添加噪声、图像滤波、图像卷积
Typescript 命名空间
28. Anomaly detection
stack-queue
不知道取什么名字
Efficient and beautiful scrolling component Slivers of Flutter tutorial (tutorial includes source code)
代码自动初始化
Web 攻击的日志分析:初学者指南
Unity-CharacterController (Character Controller)
Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:]
数据库ADB多个字符,想要导入到ES存为nested的类型,这个支持吗?有对应的文档吗
分类任务说明
主脑提示( Master-Mind Hints )