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:

  1. 7_This_is_a_test
  2. _hs_s_a_es

Sample Output:

  1. 7TI

提交代码

  1. #include<cstdio>
  2. #include<stack>
  3. #include<algorithm>
  4. #include<iostream>
  5. #include<stack>
  6. #include<set>
  7. #include<map>
  8. #include<vector>
  9. using namespace std;
  10. set<char> s;
  11. vector<char> v;
  12. int main(){
  13. //freopen("D:\\INPUT.txt","r",stdin);
  14. string s1,s2;
  15. cin>>s1>>s2;
  16. int i=,j=;
  17. while(i<s1.length()){
  18. if(s1[i]==s2[j]){
  19. j++;
  20. }
  21. else{
  22. if(s1[i]>='a'&&s1[i]<='z'){
  23. s1[i]=s1[i]-'a'+'A';
  24. }
  25. if(!s.count(s1[i])){
  26. s.insert(s1[i]);
  27. v.push_back(s1[i]);
  28. }
  29. }
  30. i++;
  31. }
  32.  
  33. vector<char>::iterator it;
  34. for(it=v.begin();it!=v.end();it++){
  35. cout<<*it;
  36. }
  37. cout<<endl;
  38. return ;
  39. }

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. CRT Library Features

    CRT Library Features The new home for Visual Studio documentation is Visual Studio 2017 Documentatio ...

  2. 查看Linux内核版本的命令

    方法一: 命令: uname -a  作用: 查看系统内核版本号及系统名称  方法二:  命令: cat /proc/version 作用: 查看目录"/proc"下version ...

  3. 删除 char[10][10] 中的一行

    1. 描述 删除二维字符数组其中一行,并用下一行进行填补 2. 代码 #include <iostream> #include <string.h> using namespa ...

  4. GIF助手激活教程(购买+激活)图文版

    GIF助手首页==>设置(右上角) ==>输入激活码会弹出购买或者激活的对话框.(如果不明白操作,可以点击如何购买激活码先查看购买帮助指南再进行购买) 点击复制设备码并购买. 此时会进入到 ...

  5. [HDU1109]模拟退火算法

    模拟退火的基本思想: (1) 初始化:初始温度T(充分大),初始解状态S(是算法迭代的起点),每个T值的迭代次数L (2) 对k=1,……,L做第(3)至第6步: (3) 产生新解$S\prime $ ...

  6. 获取显示屏的个数和分辨率 --- 通过使用OpenGL的GLFW库

    获取显示屏的个数和分辨率 - 通过使用OpenGL的GLFW库 程序 #include <iostream> // GLFW #include <GLFW/glfw3.h> i ...

  7. 14、SRA数据上传

    1.ncbi登陆,进入SRA,进入new submission 2. 1)SUBMITTER 2)PROJECT TYPE Raw sequence reads 和 ranscriptome or G ...

  8. CSS定位机制总结

    1,CSS 有三种基本的定位机制:普通流.浮动和绝对定位.除非专门指定,否则所有框都在普通流中定位.2,普通流定位:块级框从上到下一个接一个地排列,框之间的垂直距离是由框的垂直外边距计算出来.行内框在 ...

  9. sql获取上月同期

    select CONVERT(varchar(10), CONVERT(varchar(8),dateadd(month,-1,getdate()),23)+CONVERT(varchar(10),d ...

  10. VS(Visual Studio)中快速找出含中文的字符串

    环境:visual studio 2017 1.ctrl + shift + f 打卡全局查找 2.输入(".*[\u4E00-\u9FA5]+)|([\u4E00-\u9FA5]+.*&q ...