pat1084. Broken Keyboard (20)
1084. Broken Keyboard (20)
On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys will not appear on screen.
Now given a string that you are supposed to type, and the string that you actually type out, please list those keys which are for sure worn out.
Input Specification:
Each input file contains one test case. For each case, the 1st line contains the original string, and the 2nd line contains the typed-out string. Each string contains no more than 80 characters which are either English letters [A-Z] (case insensitive), digital numbers [0-9], or "_" (representing the space). It is guaranteed that both strings are non-empty.
Output Specification:
For each test case, print in one line the keys that are worn out, in the order of being detected. The English letters must be capitalized. Each worn out key must be printed once only. It is guaranteed that there is at least one worn out key.
Sample Input:
7_This_is_a_test
_hs_s_a_es
Sample Output:
7TI
#include<cstdio>
#include<stack>
#include<algorithm>
#include<iostream>
#include<stack>
#include<set>
#include<map>
#include<vector>
using namespace std;
set<char> s;
vector<char> v;
int main(){
//freopen("D:\\INPUT.txt","r",stdin);
string s1,s2;
cin>>s1>>s2;
int i=,j=;
while(i<s1.length()){
if(s1[i]==s2[j]){
j++;
}
else{
if(s1[i]>='a'&&s1[i]<='z'){
s1[i]=s1[i]-'a'+'A';
}
if(!s.count(s1[i])){
s.insert(s1[i]);
v.push_back(s1[i]);
}
}
i++;
} vector<char>::iterator it;
for(it=v.begin();it!=v.end();it++){
cout<<*it;
}
cout<<endl;
return ;
}
pat1084. Broken Keyboard (20)的更多相关文章
- PAT1084:Broken Keyboard
1084. Broken Keyboard (20) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue On a ...
- 1084. Broken Keyboard (20)【字符串操作】——PAT (Advanced Level) Practise
题目信息 1084. Broken Keyboard (20) 时间限制200 ms 内存限制65536 kB 代码长度限制16000 B On a broken keyboard, some of ...
- 1084. Broken Keyboard (20)
On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters ...
- PAT Broken Keyboard (20)
题目描写叙述 On a broken keyboard, some of the keys are worn out. So when you type some sentences, the cha ...
- PAT Advanced 1084 Broken Keyboard (20) [Hash散列]
题目 On a broken keyboard, some of the keys are worn out. So when you type some sentences, the charact ...
- PAT (Advanced Level) 1084. Broken Keyboard (20)
简单题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...
- 1084. Broken Keyboard (20)-水题
#include <iostream> #include <cstdio> #include <string.h> #include <algorithm&g ...
- 【PAT甲级】1084 Broken Keyboard (20 分)
题意: 输入两行字符串,输出第一行有而第二行没有的字符(对大小写不敏感且全部以大写输出). AAAAAccepted code: #define HAVE_STRUCT_TIMESPEC #inclu ...
- PAT 1084 Broken Keyboard
1084 Broken Keyboard (20 分) On a broken keyboard, some of the keys are worn out. So when you type ...
随机推荐
- mina中的发送延时
由于项目需要,用到了 mina 框架进行 tcp 通讯.我是初次接触 mina,于是从 Hello world 开始学习了 mina .期间遇到了一个奇怪的发送数据的延迟问题,解决的过程是曲折的,但找 ...
- 由hibernate配置inverse="true"而导致的软件错误,并分析解决此问题的过程
题目背景软件是用来做安装部署的工具,在部署一套系统时会有很多安装包,通过此工具,可以生成一个xml文件用以保存每个安装包的文件位置.顺序.参数.所需脚本.依赖条件验证(OS..net.IIS.数据版本 ...
- 分布式系统中Unique ID 的生成方法
http://darktea.github.io/notes/2013/12/08/Unique-ID 本文主要介绍在一个分布式系统中, 怎么样生成全局唯一的 ID 一, 问题描述 在分布式系统存在多 ...
- KINECT2通过ROS在线跑ORBSLAM2
source ~/.bashrc export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/user/ORB_SLAM2/Examples/ROS 上面这个一 ...
- Note: Clay Codes: Moulding MDS Codes to Yield an MSR Code
Background Erasure Code 纠删码:与纠错码.检错码类似,均为线性分组码,通过编码可以在有限损失的前提下恢复丢失的数据.  假设每个磁盘存储w比特数据,设\(d_0,\cdots ...
- win10外接显示器时有些应用和里面的字体显示比较模糊
打开系统设置 - 选择显示 - 选中外接的显示器 - 点击 "高级缩放设置" 进去后将 "允许 Windows 尝试修改应用,使其不模糊"打开,然后关闭应用再 ...
- [FZU 1901]Period II KMP
For each prefix with length P of a given string S,if S[i]=S[i+P] for i in [0..SIZE(S)-p-1], then the ...
- CF622F The Sum of the k-th Powers(拉格朗日插值)
题意 给出 \(n,k\) , \(n\le10^9,k\le10^6\) ,求 \(\sum_{i=1}^n i^k(mod\;10^9+7)\) 题解 自然数幂次和,是一个\(k+1\)次多项式, ...
- 解读人:范徉,Methylome and Metabolome Analyses Reveal Adaptive Mechanisms in Geobacter sulfurreducens Grown on Different Terminal Electron Acceptors(甲基化组学和代谢组学分析发现Geobacter sulfurreducens生长在不同电子终受体中的适应机制)
发表时间: (2019年4月) IF:3.950 单位: Fujian Provincial Key Laboratory of Soil Environmental Health and Regul ...
- CF10D/POJ2127 LCIS解题报告
题目传送门(洛谷)(CF)(POJ) 前言 期末考试前的最后一篇题解,希望期末考 rp++ 奇怪,为什么在CF上能过的代码到POJ上就 听取WA声一片 (不管了) 题目思路 LCIS模版O(n²) ...