PAT 甲级 1084. Broken Keyboard (20)
来源:互联网 发布:网络作家收入 编辑:程序博客网 时间:2024/06/06 18:55
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>using namespace std;int main(){ string s1,s2; cin>>s1>>s2; bool hash[128]={false}; for(int i=0;i<s1.length();i++){ int j; char c1,c2; for(j=0;j<s2.length();j++){ c1=s1[i]; c2=s2[j]; if(c1>='a'&&c1<='z') c1-=32; if(c2>='a'&&c2<='z') c2-=32; if(c1==c2){ break; } } if(j==s2.length()&&hash[c1]==false){ cout<<c1; hash[c1]=true; } } return 0;}
- 1084. Broken Keyboard (20)-PAT甲级试题
- 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)
- pat 1084. Broken Keyboard (20)
- PAT 1084. Broken Keyboard (20)
- 【PAT】1084. Broken Keyboard (20)
- 1084. Broken Keyboard (20) PAT
- 1029. 旧键盘(20) PAT乙级&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)
- PAT A 1084. Broken Keyboard (20)
- U3D物理引擎
- python--leetcode637. Average of Levels in Binary Tree
- Scry.info技术分享——ScryDB简介
- U3D光源烘培光照贴图和light probes
- java 给数字加上单位'万'
- PAT 甲级 1084. Broken Keyboard (20)
- js判断是否为IE678简易办法
- 微信小程序——1、搭建自己的Https服务器
- 4轴开发之串级PID调试技巧
- STM32 USART串口初始化
- 最新闻:陨石落云南,震感强烈
- 数据结构学习入门
- C++的引用【转自fenghuan】
- ubuntu17.10 网易云音乐无法启动