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 分)的更多相关文章

  1. 【PAT甲级】1084 Broken Keyboard (20 分)

    题意: 输入两行字符串,输出第一行有而第二行没有的字符(对大小写不敏感且全部以大写输出). AAAAAccepted code: #define HAVE_STRUCT_TIMESPEC #inclu ...

  2. 1084. Broken Keyboard (20)【字符串操作】——PAT (Advanced Level) Practise

    题目信息 1084. Broken Keyboard (20) 时间限制200 ms 内存限制65536 kB 代码长度限制16000 B On a broken keyboard, some of ...

  3. 1084. Broken Keyboard (20)

    On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters ...

  4. 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 ...

  5. PAT (Advanced Level) 1084. Broken Keyboard (20)

    简单题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...

  6. 1084. Broken Keyboard (20)-水题

    #include <iostream> #include <cstdio> #include <string.h> #include <algorithm&g ...

  7. PAT 1084 Broken Keyboard

    1084 Broken Keyboard (20 分)   On a broken keyboard, some of the keys are worn out. So when you type ...

  8. pat1084. Broken Keyboard (20)

    1084. Broken Keyboard (20) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue On a ...

  9. 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 ...

随机推荐

  1. Numpy 函数总结 (不断更新)

    本篇主要收集一些平时见到的 Numpy 函数. numpy.random.seed & numpy.random.RandomState np.random.seed() 和 np.rando ...

  2. iframe 问题集合

    1. 历史记录问题 Firefox: 如果iframe是静态存在在HTML中时,iframe的任何src或者location改变都会被记录到浏览器history中. 如果iframe是在页面加载完成后 ...

  3. Ubuntu 12.04硬盘安装教程

    从服务器下载Ubuntu 12.04光盘镜像文件到 C 盘.下载地址:\\192.167.100.225\share\Tool\Ubuntu\ubuntu-12.04.1-desktop-amd64. ...

  4. IOC和DI 控制反转和依赖注入

    首先要分享的是Iteye的开涛这位技术牛人对Spring框架的IOC的理解,写得非常通俗易懂,以下内容全部来自原文,原文地址:http://jinnianshilongnian.iteye.com/b ...

  5. UIImageView有关的帧动画

    纯代码:设置imageView帧动画 @interface ViewController () { UIImageView *_imgView; NSMutableArray<UIImage * ...

  6. OK335xS-Android pack-ubi-256M.sh hacking

    #/******************************************************************************* # * OK335xS-Androi ...

  7. 王垠:完全用Linux工作 - imsoft.cnblogs

    完全用Linux工作,抛弃windows 我已经半年没有使用 Windows 的方式工作了.Linux 高效的完成了我所有的工作. GNU/Linux 不是每个人都想用的.如果你只需要处理一般的事务, ...

  8. eclipse/idea批量替换空白行

    批量替换空行Ctrl+F 快捷方式打开Find/Replace工具窗选择Regular expression(idea是regex)项,允许查询匹配正则表达式在Find文本框输入正则表达式:^\s*\ ...

  9. 龙儿经理嘴上经常说的B树

    国内的数据结构教材一般是按照Knuth定义,即“阶”定义为一个节点的子节点数目的最大值. 对于一棵m阶B-tree,每个结点至多可以拥有m个子结点.各结点的关键字和可以拥有的子结点数都有限制 规定m阶 ...

  10. 无人驾驶之激光雷达&摄像头(主要from 速腾CEO 邱纯鑫分享)

    无人驾驶之激光雷达&摄像头 (from 速腾CEO 邱纯鑫公开课分享) 根据听的一些讲座和看的书籍,个人感觉:目前现在的自动驾驶,根本问题还是在于感知(路况,周边物体,交通标识等等),控制的方 ...