博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
1084. Broken Keyboard (20)
阅读量:6786 次
发布时间:2019-06-26

本文共 1499 字,大约阅读时间需要 4 分钟。

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 
#include
using namespace std;int main(int argc, const char * argv[]) { string s0, s, ans = ""; map
a; cin >> s0 >> s; for (int i = 0, j = 0; i < s0.size();) { if (s0[i] == s[j]) { i++; j++; }else{ char c = toupper(s0[i]); if (!a[c]) { a[c] = 1; ans = ans + c; } i++; } } cout << ans << endl; return 0;}

转载地址:http://vidgo.baihongyu.com/

你可能感兴趣的文章
web安全实践系列导航
查看>>
[Oracle]GoldenGate官方文档
查看>>
第 42 章 WMware
查看>>
动感的网页相册
查看>>
Nginx的反向代理与负载均衡
查看>>
redis之(十四)redis的主从复制的原理
查看>>
Velocity入门指南
查看>>
ntp redhat
查看>>
sum(case when status=1 then 1 else 0 end) 的意思
查看>>
Win7硬盘安装方法
查看>>
python - 列表
查看>>
UIVisualEffectView用法
查看>>
springmvc+mybatis整合cms+UC浏览器文章功能
查看>>
docker安装(centos6.5_x86_64)
查看>>
mysql悲观锁与乐观锁
查看>>
ubuntu下python2-python3版共存,创建django项目出现的问题
查看>>
2018.4.3三周第二次课
查看>>
eclipse_jee版本提供了从数据库直接生成实体类的工具!
查看>>
Error: Can't set headers after they are sent
查看>>
本地用户模式、虚拟用户模式使用
查看>>