PAT_A1084#Broken Keyboard
Source:
Description:
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
Keys:
Code:
- /*
- Data: 2019-07-21 19:31:31
- Problem: PAT_A1084#Broken Keyboard
- AC: 10:43
- 题目大意:
- 给定输入和输出字符串,打印坏掉的键(大写)
- */
- #include<cstdio>
- #include<string>
- #include<iostream>
- #include<algorithm>
- using namespace std;
- char mp[]={};
- int main()
- {
- #ifdef ONLINE_JUDGE
- #else
- freopen("Test.txt", "r", stdin);
- #endif
- string s,t,r="";
- cin >> s >> t;
- transform(s.begin(),s.end(),s.begin(),::toupper);
- transform(t.begin(),t.end(),t.begin(),::toupper);
- for(int i=; i<s.size(); i++)
- {
- if(t.size()!= && s[i]==t[])
- t.erase(,);
- else
- {
- mp[s[i]]++;
- if(mp[s[i]]==)
- r += s.substr(i,);
- }
- }
- cout << r;
- return ;
- }
PAT_A1084#Broken Keyboard的更多相关文章
- UVa 11998 Broken Keyboard (数组模拟链表问题)
题目链接: 传送门 Broken Keyboard #include<bits/stdc++.h> using namespace std; char str[100010]; int m ...
- UVa 11988 Broken Keyboard(链表->数组实现)
/*数组形式描述链表:链表不一定要用指针. 题目链接:UVa 11988 Broken Keyboard 题目大意: 小明没有开屏幕输入一个字符串,电脑键盘出现了问题会不定时的录入 home end ...
- 1084. Broken Keyboard (20)
On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters ...
- B - Broken Keyboard (a.k.a. Beiju Text)
Problem B Broken Keyboard (a.k.a. Beiju Text) You're typing a long text with a broken keyboard. Well ...
- uva - Broken Keyboard (a.k.a. Beiju Text)(链表)
11988 - Broken Keyboard (a.k.a. Beiju Text) You’re typing a long text with a broken keyboard. Well i ...
- PAT1084:Broken Keyboard
1084. Broken Keyboard (20) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue On a ...
- PAT 1084 Broken Keyboard
1084 Broken Keyboard (20 分) On a broken keyboard, some of the keys are worn out. So when you type ...
- A1084. Broken Keyboard
On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters ...
- B - Broken Keyboard (a.k.a. Beiju Text) 数组模拟链表
You're typing a long text with a broken keyboard. Well it's not so badly broken. The only problem wi ...
随机推荐
- ios 最全的常用字符串操作
1.将NSData / NSString转化 1 2 3 NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding]; // 将字符串 ...
- HTML-参考手册: URL 编码
ylbtech-HTML-参考手册: URL 编码 1.返回顶部 1. HTML URL 编码 参考手册 URL 编码会将字符转换为可通过因特网传输的格式. URL - 统一资源定位器 Web 浏览器 ...
- python 使用yaml模块
python:yaml模块一.yaml文件介绍YAML是一种简洁的非标记语言.其以数据为中心,使用空白,缩进,分行组织数据,从而使得表示更加简洁.1. yaml文件规则基本规则: 大小写敏感 ...
- java 实现一套流程管理、流转的思路(伪工作流) 【仅供参考】
转: java 实现一套流程管理.流转的思路(伪工作流) 在做某个管理项目时,被要求实现一套流程管理,比如请假的申请审批流程等,在参考了很多资料,并和同事讨论后,得到了一个自主实现的流程管理. 以下提 ...
- 第一周复习二 (CSS样式表及其属性)
样式表三种写法 1内联写法:style直接写在标签内.个人感觉多用于个别标签,一般情况优先级较高 style="font-size:16px;" 2内嵌写法:写在<head& ...
- jQuery层次选择器再探究(原创)
关于层次选择器的详解: 1)可以选取某一个元素的所有的后代元素,得到一个jQuery对象的集合--->$('prev descendant') 2)可以选取某一个元素的子辈的所有的元素,得到一个 ...
- shell编程:expr的数学运算
运算符两种方式 方式一:expr $num1 operator $num2 方式二:$(($num1 operator $num2)) (方式二在运算符“=”时候会出错) 1+2.sh 这个代码有点问 ...
- bootstrap学习(三)表单
基本实例: from-group:可以是其内的标签排列更好 from-control:使标签宽度为100% <form> <div class="form-group&qu ...
- v-slot vue2.6新增指令使用指南
子组件 <template> <div class="wrapper"> <slot name="demo" :msg=" ...
- 一、hibernate环境搭建
hibernate环境搭建 下载hibernate hibernate的jar 连接数据库的jar 解压hibernate,解压后目录结构 documentation :对应hibernate开发文档 ...