当前位置:网站首页>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;
}
边栏推荐
- JVM上篇:内存与垃圾回收篇七--运行时数据区-堆
- I've heard the most self disciplined sentence: those I can't say are silent
- 听过最自律的一句话: 那些我难以言表 不作声响
- B1021 single digit statistics
- JVM Part 1: memory and garbage collection part 8 - runtime data area - Method area
- [optical flow] - data format analysis, flowwarp visualization
- Select user stories | the false positive rate of hole state in jushuitan is almost 0. How to do this?
- Install pyGame
- B1029 旧键盘
- Raspberry pie RTMP streaming local camera image
猜你喜欢
随机推荐
Detailed description of binary search tree
2021 OWASP top 5: security configuration error
B1030 完美数列
B1024 科学计数法
弹球小游戏
Standard dialog qmessagebox
File dialog box
2、 MySQL advanced
Basic operation of vim
B1022 a+b in d-ary
JVM Part 1: memory and garbage collection part 12 -- stringtable
集合框架的使用
2021 OWASP top 4: unsafe design
B1027 打印沙漏
JVM Part 1: memory and garbage collection part 6 -- runtime data area local method & local method stack
[acwing] solution to the 61st weekly match
B1021 single digit statistics
JVM上篇:内存与垃圾回收篇--运行时数据区四-程序计数器
JVM上篇:内存与垃圾回收篇三--运行时数据区-概述及线程
Counting Nodes in a Binary Search Tree
![[CSAPP] Application of bit vectors | encoding and byte ordering](/img/96/344936abad90ea156533ff49e74f59.gif)








