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
分析:注意字符串结尾是string::npos, 7行搞定!
/**
* Copyright(c)
* All rights reserved.
* Author : Mered1th
* Date : 2019-02-25-19.55.33
* Description : A1084
*/
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<unordered_set>
#include<map>
#include<vector>
#include<set>
#include<unordered_map>
using namespace std;
int main(){
#ifdef ONLINE_JUDGE
#else
freopen("1.txt", "r", stdin);
#endif
string s1,s2,ans="";
cin>>s1>>s2;
;i<s1.length();i++){
if(s2.find(s1[i])==string::npos &&ans.find(toupper(s1[i]))==string::npos){
ans+=toupper(s1[i]);
}
}
cout<<ans;
;
}
1084 Broken Keyboard (20 分)的更多相关文章
- 【PAT甲级】1084 Broken Keyboard (20 分)
题意: 输入两行字符串,输出第一行有而第二行没有的字符(对大小写不敏感且全部以大写输出). AAAAAccepted code: #define HAVE_STRUCT_TIMESPEC #inclu ...
- 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 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
1084 Broken Keyboard (20 分) On a broken keyboard, some of the keys are worn out. So when you type ...
- pat1084. Broken Keyboard (20)
1084. Broken Keyboard (20) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue On a ...
- pat 1084 Broken Keyboard(20 分)
1084 Broken Keyboard(20 分) On a broken keyboard, some of the keys are worn out. So when you type som ...
随机推荐
- ThinkPad 复刻计划 ThinkPad Time Machine
在快节奏的高科技市场中,针对性的进化 ThinkPad 的设计几乎是闻所未闻的.在汽车行业,保时捷无疑干的不错,但我不认为有任何其他的电脑公司可以顶住压力,坚持自己的初心这么久.没有任何一个竞争对手可 ...
- OC基础:Date 分类: ios学习 OC 2015-06-22 19:16 158人阅读 评论(0) 收藏
NSDate 日期类,继承自NSObject,代表一个时间点 NSDate *date=[NSDate date]; NSLog(@"%@",date); //格林尼治时间, ...
- 题目1001:A+B for Matrices
题目1001:A+B for Matrices 时间限制:1 秒内存限制:32 兆 题目描述: This time, you are supposed to find A+B where A and ...
- proxool配置及测试(数据库用的MySQL)
Proxool连接池设置 Proxool连接池是sourceforge下的一个开源项目,这个项目提供一个健壮.易用的连接池,最为关键的是这个连接池提供监控的功能,方便易用,便于发现连接泄漏的情况. ...
- 第十章 企业项目开发--分布式缓存Redis(2)
注意:本章代码是在上一章的基础上进行添加修改,上一章链接<第九章 企业项目开发--分布式缓存Redis(1)> 上一章说了ShardedJedisPool的创建过程,以及redis五种数据 ...
- android_serialport_api hacking
/************************************************************************************ * * android_se ...
- java语法基础练习
1.阅读示例: EnumTest.java,并运行.分析结果 代码: public class EnumTest { public static void main(String[] args) { ...
- HDU 4640 状态压缩DP 未写完
原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=4640 解题思路: 首先用一个简单的2^n*n的dp可以求出一个人访问一个给定状态的最小花费,因为这i个 ...
- Visual Studio 2015 编译错误 File 的值+乱码的解决方法
======================================== VS2015调试项目时,会报莫名奇妙的错误,如下图所示: 程序编译,提示有错误:Visual Studio 2015 ...
- 如何快速配好java环境变量和查看电脑上安装JDK的版本位数
今天一个新手在群里问自己的Eclipse打不开,然后我是属于那种热心肠的人,一般自己知道的就会告诉他们,看了下,是环境变量没有配好,反正我觉得配环境比较简单,现在就教大家简单的环境变量配法 path ...