PAT甲级——A1084 Broken Keyboard
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 <iostream>
#include <string>
using namespace std;
string str1, str2;
int main()
{
cin >> str1 >> str2;
string res="";
char c;
for (int i = , j = ; i < str1.length(); ++i)
{
while (j < str2.length() && str1[i] == str2[j])
{
++i;
++j;
}
c = toupper(str1[i]);
if (res.find(c) == -)
res += c;
}
cout << res << endl;
return ;
}
PAT甲级——A1084 Broken Keyboard的更多相关文章
- A1084. Broken Keyboard
On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters ...
- PAT 甲级 1112 Stucked Keyboard
https://pintia.cn/problem-sets/994805342720868352/problems/994805357933608960 On a broken keyboard, ...
- PAT甲级——1112 Stucked Keyboard (字符串+stl)
此文章同步发布在我的CSDN上:https://blog.csdn.net/weixin_44385565/article/details/90041078 1112 Stucked Keyboa ...
- PAT甲级——A1112 Stucked Keyboard【20】
On a broken keyboard, some of the keys are always stucked. So when you type some sentences, the char ...
- 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 ...
- PAT甲级 1112 Stucked Keyboard
题目链接:https://pintia.cn/problem-sets/994805342720868352/problems/994805357933608960 这道题初次写的时候,思路也就是考虑 ...
- PAT_A1084#Broken Keyboard
Source: PAT A1084 Broken Keyboard (20 分) Description: On a broken keyboard, some of the keys are wor ...
- PAT甲级题解分类byZlc
专题一 字符串处理 A1001 Format(20) #include<cstdio> int main () { ]; int a,b,sum; scanf ("%d %d& ...
- PAT 1084 Broken Keyboard
1084 Broken Keyboard (20 分) On a broken keyboard, some of the keys are worn out. So when you type ...
随机推荐
- 三层(3-tier architecture)基础
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/lhc2207221755/article/details/24802053 之前看过非常多关 ...
- Neo4j和Elasticsearch
Neo4j和Elasticsearch Neo4j和Elasticsearch是一种让人眼前一亮的组合,为什么需要把搜索和图表结合起来呢?它们是如何使用的呢? 在无处不在的互联网搜索引擎的推动下,全文 ...
- CSS代码命名惯例语义化的方法
CSS代码的命名惯例一直是大家热门讨论的话题.今天暴风彬彬想通过分析一个流行三栏布局中的必要元素,来为大家讲解关于使用语义化方法替代结构化方法来命名CSS类的建议和指导. 您还可以参考彬Go的相关文章 ...
- iphone11系统输入框的光标位置不正常
本人的系统是11.3的是正常的,却发现测试机的11.1和11.2的光标位置在输入框的下边.百度一下,很多人有同样的问题,在此记录一下 解决办法一: //弹框弹出后执行如下代码 $('body').cs ...
- 【笔记篇】斜率优化dp(一) HNOI2008玩具装箱
斜率优化dp 本来想直接肝这玩意的结果还是被忽悠着做了两道数论 现在整天浑浑噩噩无心学习甚至都不是太想颓废是不是药丸的表现 各位要知道我就是故意要打删除线并不是因为排版错乱 反正就是一个del标签嘛并 ...
- 01.SpringMVC快速入门
1.导入jar包 2.在web.xml中配置前端控制器 <!-- spring前端控制器 --> <servlet> <servlet-name>springmvc ...
- leetcode-229-求众数②
题目描述: 方法一:摩尔投票法 class Solution: def majorityElement(self, nums: List[int]) -> List[int]: candiate ...
- Java 基础 - CLASSPATH 到底是什么
关于JAVA项目中CLASSPATH路径详解 https://www.cnblogs.com/hibou/p/8324276.html java项目中的classpath到底是什么 https://s ...
- rancher v2.2.4创建kubernetes集群出现[etcd] Failed to bring up Etcd Plane: [etcd] Etcd Cluster is not healthy
主机:rancher(172.16.2.17),master(172.16.2.95),node01(172.16.2.234),node02(172.16.2.67) 问题:开始是用的rancher ...
- 使用Maven命令行下载依赖库
这篇文章,不是教大家如何新建maven项目,不是与大家分享Eclipse与Maven整合. 注意:是在命令行下使用Maven下载依赖库. 废话不说,步骤如下: 1.保证电脑上已成功安装了JDK.运行j ...