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<iostream>
using namespace std;
int trans(char c){
if(c >= 'a' && c <= 'z')
return c - 'a' + ;
else if(c >= 'A' && c <= 'Z')
return c - 'A' + ;
else if(c >= '' && c <= '')
return c - '';
else return ;
}
int main(){
char a[], b[];
int hashTab[] = {,};
scanf("%s %s", a, b);
for(int i = ; b[i] != '\0'; i++){
hashTab[trans(b[i])]= ;
}
for(int i = ; a[i] != '\0'; i++){
if(hashTab[trans(a[i])] == ){
hashTab[trans(a[i])] = ;
if(a[i] <= 'z' && a[i] >= 'a')
printf("%c", a[i] - 'a' + 'A');
else printf("%c", a[i]);
}
}
cin >> a;
return ;
}

总结:

1、由于本题不区分大小写,所以将大小写字母映射为10-35, _映射为36, 0-9映射为0-9即可。如果区分大小写,则可以直接将ASCII的个数128映射为数组下标。

A1084. Broken Keyboard的更多相关文章

  1. PAT甲级——A1084 Broken Keyboard

    On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters ...

  2. PAT_A1084#Broken Keyboard

    Source: PAT A1084 Broken Keyboard (20 分) Description: On a broken keyboard, some of the keys are wor ...

  3. 1084 Broken Keyboard (20 分)

    1084 Broken Keyboard (20 分) On a broken keyboard, some of the keys are worn out. So when you type so ...

  4. UVa 11998 Broken Keyboard (数组模拟链表问题)

    题目链接: 传送门 Broken Keyboard #include<bits/stdc++.h> using namespace std; char str[100010]; int m ...

  5. UVa 11988 Broken Keyboard(链表->数组实现)

    /*数组形式描述链表:链表不一定要用指针. 题目链接:UVa 11988 Broken Keyboard 题目大意: 小明没有开屏幕输入一个字符串,电脑键盘出现了问题会不定时的录入 home end ...

  6. 1084. Broken Keyboard (20)

    On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters ...

  7. 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 ...

  8. 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 ...

  9. PAT1084:Broken Keyboard

    1084. Broken Keyboard (20) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue On a ...

随机推荐

  1. C语言基础复习:字符,字符数组,字符串,字符指针

    1. 概述2. 字符2.1 字符定义和大小2.2 字符的输入和输出2.3 字符的计算3. 字符数组3.1 字符数组的定义和大小3.2 字符数组的输入和输出3.3 字符数组的计算4. 字符串4.1 字符 ...

  2. 为小米(红米)6A解锁_ROOT_安装天下游虚拟定位教程_已亲身验证通过!附图

    第一步骤: 把TeamViewer发给客户 第二步骤: 在自己电脑上购买小米账号:http://shop1.91kami.com/UXWHTEY9KN?cid=1200 要求:(购买邮箱注册账号,需要 ...

  3. 普通程序员看k8s基于角色的访问控制(RBAC)

    一.知识准备 ● 上一节描述了k8s的账户管理,本文描述基于角色的访问控制 ● 网上RBAC的文章非常多,具体概念大神们也解释得很详细,本文没有站在高屋建瓴的角度去描述RBAC,而是站在一个普通程序员 ...

  4. 软件工程M1/M2总结

    也不分M1/M2了,就从头到尾的梳理一下这学期的软工课吧. 第一节课,老师就稀里哗啦说了一下这学期要怎么搞,什么个人项目啦,结对项目啦,团队项目一二啦,还要组队啊什么的,然后风风火火的组队. 个人项目 ...

  5. HanderBar

    对于java开发,涉及到页面展示时,比较主流的有两种解决方案: 1. struts2+vo+el表达式. 这种方式,重点不在于struts2,而是vo和el表达式,其基本思想是:根据页面需要的信息,构 ...

  6. HDOJ2009_求数列的和

    简单的考察对浮点数使用的水题 HDOJ2009_求数列的和 #include<iostream> #include<stdio.h> #include<stdlib.h& ...

  7. PAT 1013 数素数

    https://pintia.cn/problem-sets/994805260223102976/problems/994805309963354112 令P~i~表示第i个素数.现任给两个正整数M ...

  8. Fantacy团队周四站立会议

    词频分析模型 1.会议时间:2016年3月31日12:07~12:30. 持续时长:23分钟 会议参加成员:组长:杨若鹏 http://www.cnblogs.com/robinYangRP/ 组员: ...

  9. hive分区表

    分区表创建 row format delimited fields terminated by ',';指明以逗号作为分隔符 依靠插入表创建分区表  从表sample_table选择 满足分区条件的 ...

  10. java List<String>的初始化

    今天在处理生成excel的时候用到了java的list,但是需要直接赋值固定的几个变量,如果先初始化然后add的方法: List<String> name = new ArrayList( ...