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. 杂项:TModJS

    ylbtech-杂项:TModJS TmodJS(原名 atc)是一个简单易用的前端模板预编译工具.它通过预编译技术让前端模板突破浏览器限制,实现后端模板一样的同步“文件”加载能力.它采用目录来组织维 ...

  2. Lua虚拟机初始化

    转自:http://www.cnblogs.com/ringofthec/archive/2010/11/09/lua_State.html 1. 创建lua虚拟机 lua_State *lua_ne ...

  3. 进程vs线程

    内存中的内容不同 进程->{ 进程是系统分配资源的最基本单位,线程是进程的一部分, 进程中存储文件和网络句柄 } 线程->{ 栈(每个线程都有一个栈空间) pc(当前或下一条指令的地址,指 ...

  4. Ajax的包装

    /** * Created by Administrator on 2016/12/27. *//** * 创建XMLHttpRequest对象 * @param _method 请求方式: post ...

  5. centos6 搭建IPSEC

    http://www.maxwhale.com/how-to-install-l2tp-vpn-on-centos/ http://blog.earth-works.com/2013/02/22/ho ...

  6. 恢复到版本并销毁之后的git提交记录

    git reset --hard HEAD~1(或者你想要的版本号) git push --force # 千万注意:此操作无法恢复

  7. 11_adb指令练习

    通过adb指令咱们装相关的项目.把项目推到设备上.也可以进行文件相关的操作.adb的一些相关的指令. 开启连接IDE和设备的服务. adb可以安装应用也可以卸载应用.项目怎么去区分?一个包名一个是签名 ...

  8. Java解析XML:Jdom解析和SAX解析

    今天看了Java解析XML的几种方法,记录一下 1.Jdom解析 (1)读取XML内容 private static void readXML() { // TODO Auto-generated m ...

  9. 基于netty框架的轻量级RPC实现(附源码)

    前言 Rpc( Remote procedure call):是一种请求 - 响应协议.RPC由客户端启动,客户端向已知的远程服务器发送请求消息,以使用提供的参数执行指定的过程.远程服务器向客户端发送 ...

  10. Mysql分片后分页排序拉取数据的方法

    高并发大流量的互联网架构,一般通过服务层来访问数据库,随着数据量的增大,数据库需要进行水平切分,分库后将数据分布到不同的数据库实例(甚至物理机器)上,以达到降低数据量,增加实例数的扩容目的. 一旦涉及 ...