1084 Broken Keyboard
题意:给出两个字符串(有字母,数字和下划线_组成),第一个字符串str1是由键盘输入的字符串,第二个字符串str2是屏幕显示的字符串,问键盘有哪几个按键坏了,根据输入的顺序,输出坏掉的键(仅输出一次)。要求输出字母为大写。
代码:
#include <cstdio>
#include <cstring>
#include <ctype.h>
int main()
{
], str2[];
]={false};//goodKeys[ch]为true表示字符ch为完好的键
scanf("%s",str1);
scanf("%s",str2);
int len=strlen(str2);
;i<len;i++){
str2[i]=toupper(str2[i]);//小写转大写
goodKeys[str2[i]]=true;
}
len=strlen(str1);
;i<len;i++){
str1[i]=toupper(str1[i]);
if(goodKeys[str1[i]]==false) {
goodKeys[str1[i]]=true;
printf("%c",str1[i]);
}
}
;
}
1084 Broken Keyboard的更多相关文章
- PAT 1084 Broken Keyboard
1084 Broken Keyboard (20 分) On a broken keyboard, some of the keys are worn out. So when you type ...
- 1084 Broken Keyboard (20 分)
1084 Broken Keyboard (20 分) On a broken keyboard, some of the keys are worn out. So when you type so ...
- PAT 1084 Broken Keyboard[比较]
1084 Broken Keyboard (20 分) On a broken keyboard, some of the keys are worn out. So when you type so ...
- 1084. Broken Keyboard (20)【字符串操作】——PAT (Advanced Level) Practise
题目信息 1084. Broken Keyboard (20) 时间限制200 ms 内存限制65536 kB 代码长度限制16000 B On a broken keyboard, some of ...
- pat 1084 Broken Keyboard(20 分)
1084 Broken Keyboard(20 分) On a broken keyboard, some of the keys are worn out. So when you type som ...
- 1084. Broken Keyboard (20)
On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters ...
- 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 (Advanced Level) 1084. Broken Keyboard (20)
简单题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...
- 1084. Broken Keyboard (20)-水题
#include <iostream> #include <cstdio> #include <string.h> #include <algorithm&g ...
随机推荐
- 用Heartbeat实现HA集群
HA即高可用(high avaliable),又被叫做双机热备,用于关键性业务,简单理解就是,有两台机器A和B,正常是A提供服务,B待机闲置,当A宕机或服务宕掉,会切换到B机器继续提供服务.常用实现高 ...
- Prism初研究之使用Prism实现WPF的MVVM模式
转自:http://www.cnblogs.com/qianzi067/p/5804880.html
- Prism技术开发文档(五星级)
转自csdn博客园:http://blog.csdn.net/albert528108/article/details/52122547
- 【Demo】CSS3 2D转换
2D转换transform 2D变换方法: translate() 根据左(X轴)和顶部(Y轴)位置给定的参数,从当前元素位置移动. div { transform: translate(50px,1 ...
- idea maven打包 install 报错The packaging for this project did not assign a file to the build artifact
如题,这其实是个低级错误,这个错的意思是,找不到这个插件的包. 原因很简单,不是找不到这个打包插件,而是自己的项目没有从maven仓库里加载这个包到项目里,因此会找不到. 看一下问什么会报这个错: 大 ...
- 《The Cg Tutorial》阅读笔记——光照 Lighting
本文为大便一箩筐的原创内容,转载请注明出处,谢谢:http://www.cnblogs.com/dbylk/p/4796306.html 光照 Lighting 一.常见的几种光照模型 二.基本的光照 ...
- UI-了解ISO
1. iOS学习路线: C语言:数据类型.流程控制.函数.指针.字符串.结构体.枚举.预处理: OC:面向对象.内存管理.分类.协议.Block.KVC/KVO.Foundation框架: iOS基础 ...
- thinking java
public class CrossContainerIteration{ public static void display(Iterator<Pet> it){ while(it.h ...
- <input type="checkbox" name="" value=" ">
<input type="checkbox" name="" value=" ">
- linux时间管理 之 jiffies
1.jiffies 又称时钟滴答,是一个全局变量,它的值在系统引导的时候初始化为0,在时钟中断初始化完成后,每次时钟中断发生,在时钟中断处理例程中都会将jiffies的值 +1. jiffies_64 ...