1084. Broken Keyboard (20)

时间限制
200 ms
内存限制
65536 kB
代码长度限制
16000 B
判题程序
Standard
作者
CHEN, Yue

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

  1. PAT1084:Broken Keyboard

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

  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 Broken Keyboard (20)

    题目描写叙述 On a broken keyboard, some of the keys are worn out. So when you type some sentences, the cha ...

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

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

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

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

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

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

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

  9. PAT 1084 Broken Keyboard

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

随机推荐

  1. 发布倒计时!JDK11为我们带来哪些新特性?

    今年7月底,JDK11已经进入了Rampdown Phase Two阶段,这标志着该版本所有特性已经被冻结,不会有新的JEP会加入版本中. 这一阶段将会修复P1–P2级BUG,之后,JDK11预定于今 ...

  2. shell入门-grep2

    案例介绍 搜索关键词带‘root’的行 并输出行号 [root@wangshaojun ~]# cg -n 'root' 1.txt1:root:x:0:0:root:/root:/bin/bash1 ...

  3. 第3章 机器学习的典型应用 3-4 典型应用-ctr预估和协同过滤

    ctr预估,用户点击率的预估.这个算法的名字叫ctr预估,但是它背后算法是线性的逻辑回归. 现在的推荐系统除了可能会用关联规则之外,现在还有一些所谓的更新的协同过滤的算法.

  4. [51nod1119]机器人走方格V2

    解题关键: 1.此题用dp的方法可以看出,dp矩阵为杨辉三角,通过总结,可以得出 答案的解为$C_{n + m - 2}^{n - 1}$ 2.此题可用组合数学的思想考虑,总的步数一共有$n+m-2$ ...

  5. img src 直接显示图片字符串,微信例子

    <div class="weui-cell__hd"><img src="data:image/png;base64,iVBORw0KGgoAAAANS ...

  6. 打开Visual Studio Code,rg.exe占用CPU过高

    打开Visual Studio Code,再打开文件-首选项-设置 搜索“followSymlinks” 将“√”给取消掉

  7. js或jQuery中 邮箱跳转的问题,跳转到指定邮箱(通过layui的ifram实现)

    对刚做的东西记个笔记 如果遇到同样问题解决起来又问题的欢迎留言 var emailtext = $("#TextBoxEmail").val();//获得要截取的值 var arr ...

  8. CentOS6.5内核升级FATAL: Module scsi_wait_scan not found

    系统为CentOS6.5的虚拟机内核升级至版本4.6.0-1,重启后,报以下错误: Module scsi_wait_scan not found. 无法进入系统. 问题描述详见:Known Issu ...

  9. 飘逸的python - 装饰器的本质

    很多人把装饰器搞的很复杂,其实本质很简单. 首先,什么是装饰器呢?在代码中发现戴着@xxx帽子的,就是装饰器. 那要怎么自己定义一个装饰器呢? 其实任何一个接收一个参数的callable都可以用来做装 ...

  10. Solr 6.7学习笔记(02)-- 配置文件 managed-schema (schema.xml)(1)

    刚学Solr(版本6.7.0),新建一个core时,提示要求schema.xml文件,我找了半天也没在源码包中找到名为schema.xml的文件.这个版本其实用的是managed-schema文件,没 ...