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 ...
随机推荐
- Treflection03_getFields_getField
1. package reflectionZ; import java.lang.reflect.Constructor; import java.lang.reflect.Field; public ...
- Android两个Activity之间的数据交换
1. 不带数据 @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceS ...
- 【scala】构造器
和Java或C++一样,Scala可以有任意多的构造器. 不过Scala类有一个构造器比其他所有构造器都更为重要,它就是主构造器. 除了主构造器之外,类还可以有任意多的辅助构造器. 主构造器 在Sca ...
- Prism开发人员指南5-WPF开发 文档翻译(纯汉语版)
2014四月 Prism以示例和文档的形式帮助你更简单的设计丰富灵活易维护的WPF程序.其中使用的设计模式体现了一些重要的设计原则,例如分离关注点和松耦合,Prism帮助你利用松耦合组件设 ...
- DTO数据传输对象
如果有多个对象需要传输到页面上需要用DTO传输
- 2017.11.24 Stm8L151-factory
Marking---------factory fun... /** ***************************************************************** ...
- 转一篇pgpool配置
转一篇pgpool配置 http://dz.sdut.edu.cn/blog/subaochen/2013/08/postgresql-9-1的failover配置及其管理/ 环境介绍 在两台虚拟机上 ...
- 有效处理Java异常三原则
Java中异常提供了一种识别及响应错误情况的一致性机制,有效地异常处理能使程序更加健壮.易于调试.异常之所以是一种强大的调试手段,在于其回答了以下三个问题: 什么出了错? 在哪出的错? 为什么出错? ...
- Java中BIO,NIO,AIO的理解
在高性能的IO体系设计中,有几个名词概念常常会使我们感到迷惑不解.具体如下: 1 什么是同步? 2 什么是异步? 3 什么是阻塞? 4 什么是非阻塞? 5 什么是同步阻塞? 6 什么是同步非阻塞? 7 ...
- 在Blender上安装RenderMan插件
2018/3/27 Download and Install Blender itself Download RenderMan Installer (Need to register an acco ...