PAT-A-1084. Broken Keyboard (20)
来源:互联网 发布:大数据 企业管理 编辑:程序博客网 时间:2024/05/17 01:56
1084. Broken Keyboard (20)
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_esSample Output:
7TI
#include<iostream>#include<cstdio>#include<string.h>using namespace std;char st[100],st2[200];int table[200] = { 0 };int main(){ cin >> st; cin >> st2; int len = strlen(st); for (int i = 0; i < len; i++) { table[st[i]]++; } int len2 = strlen(st2); for (int i = 0; i < len2; i++) { table[st2[i]]--; } for (int i = 0; i < len; i++) { if (table[st[i]] != 0) { if (st[i] <= 'Z'&&st[i] >= 'A') { table[st[i] + 32] = 0; table[st[i]] = 0; cout << st[i]; } else if (st[i] >= 'a'&&st[i] <= 'z') { table[st[i]] = 0; table[st[i] - 32] = 0; cout << (char)(st[i] - 32); } else { table[st[i]] = 0; cout << st[i]; } } } system("pause"); return 0;}
- PAT A 1084. Broken Keyboard (20)
- PAT-A 1084. Broken Keyboard (20)
- PAT-A-1084. Broken Keyboard (20)
- Pat(A) 1084. Broken Keyboard (20)
- PAT(A)1084. Broken Keyboard
- PAT-A 1084. Broken Keyboard
- pat 1084. Broken Keyboard (20)
- PAT 1084. Broken Keyboard (20)
- PAT 1084. Broken Keyboard (20)
- pat 1084. Broken Keyboard (20)
- PAT 1084. Broken Keyboard (20)
- 【PAT】1084. Broken Keyboard (20)
- 1084. Broken Keyboard (20) PAT
- PAT 1084. Broken Keyboard
- PAT 1084. Broken Keyboard
- 【PAT】1084. Broken Keyboard
- pat 1084. Broken Keyboard
- PAT Broken Keyboard (20)
- 配置jdk环境变量之后输入java -version出现bash: ./java: /lib/ld-linux.so.2: bad ELF interpreter: 没有那个文件或目录
- PAT程序设计考题——甲级1002(A+B for Polynomials ) C++实现
- 170618 杂项-二叉搜索树和图的相关算法
- C++ 制作 json 数据 并 传送给服务端(Server) 的 php
- 对Map中的value进行排序
- PAT-A-1084. Broken Keyboard (20)
- React.js 官网资料摘记:组件&Props
- 第一个错误的代码版本
- 大整数运算库gmp安装及使用
- 自动化测试工具 Selenium WebDriver 入门教程
- Java POI导出Word文档
- java语言基础(74)——多维集合的存储和遍历
- 《C程序设计语言》示例报错“conflicting types for ‘getline’”勘误
- 新手看php手册的正确姿势