当前位置:网站首页>B1029 old keyboard
B1029 old keyboard
2022-07-27 05:20:00 【Ye Chen】
1029 Old keyboard (20 branch )
Some keys on the old keyboard are broken , So when you type a paragraph , The corresponding character will not appear . Now give a paragraph of text that should be entered 、 And the text actually entered , Please list the keys that must be broken .
Input format :
Enter in 2 Each line gives the text that should be entered 、 And the text actually entered . Each paragraph is no more than 80 Character string , By letter A-Z( Including big 、 A lowercase letter )、 Numbers 0-9、 And underline _( On behalf of the space ) form . Title assurance 2 None of the strings are empty .
Output format :
In the order of discovery , Output broken keys on one line . Only uppercase letters are output , Each bad key is output only once . The title is guaranteed to have at least 1 Bad key .
sample input
7_This_is_a_test
_hs_s_a_es
sample output
7TI
Topic analysis :
- Use toupper Function converts lowercase letters to large letters and saves all missing letters s3 in
- Traverse s3 duplicate removal
The code is as follows :
#include<bits/stdc++.h>
using namespace std;
int main(){
string s1,s2,s3;
cin>>s1>>s2;
for(int i=0;i<s1.size();i++){
if(s2.find(s1[i])==string::npos&&s2.find(toupper(s1[i]))==string::npos){
s3+=toupper(s1[i]);//toupper Function to convert lowercase letters to uppercase letters
}
}
for(int i=0;i<s3.size();i++){
string s=s3.substr(0,i);// Create string s3[0,i)
if(s.find(s3[i])==string::npos){
cout<<s3[i];
}
}
// You can also use character arrays to store , Prioritize , After heavy unique(), Traversal up s3, Print in the original order
return 0;
}
边栏推荐
- B1028 人口普查
- JVM上篇:内存与垃圾回收篇六--运行时数据区-本地方法&本地方法栈
- 2022年郑州轻工业新生赛题目-打死我也不说
- Database design - relational data theory (ultra detailed)
- B1027 打印沙漏
- 一、MySQL基础
- [Niuke discussion area] Chapter 7: building safe and efficient enterprise services
- JVM Part 1: memory and garbage collection part 3 - runtime data area - overview and threads
- JVM Part 1: memory and garbage collection part 10 - runtime data area - direct memory
- B1026 程序运行时间
猜你喜欢

JVM Part 1: memory and garbage collection -- runtime data area 4 - program counter

JVM上篇:内存与垃圾回收篇十二--StringTable

探寻通用奥特能平台安全、智能、性能的奥秘!

Database connection pool & Druid usage

Use of collection framework

JVM Part 1: memory and garbage collection part 7 -- runtime data area heap

JVM上篇:内存与垃圾回收篇十一--执行引擎

精选用户故事|洞态在聚水潭的误报率几乎为0,如何做到?

JVM Part 1: memory and garbage collection part 8 - runtime data area - Method area

笔记系列之docker安装Postgresql 14
随机推荐
LocalDateTime和ZonedDateTime
JVM上篇:内存与垃圾回收篇七--运行时数据区-堆
Derivation and explanation of PBR physical illumination calculation formula
DBUtils
Acceptance and neglect of events
JVM Part 1: memory and garbage collection part 5 -- runtime data area virtual machine stack
使用Druid连接池创建DataSource(数据源)
[untitled] I is circularly accumulated under certain conditions. The condition is usually the length of the loop array. When it exceeds the length, the loop will stop. Because the object cannot judge
抽卡程序模拟
JVM上篇:内存与垃圾回收篇三--运行时数据区-概述及线程
Test basis 5
B1027 打印沙漏
Interface and abstract class / method learning demo
Li Kou achieved the second largest result
Integrate SSM
B1026 程序运行时间
B1029 旧键盘
Acticiti中startProcessInstanceByKey方法在variable表中的如何存储
B1025 reverse linked list*******
idea远程调试debug