#include <iostream>
#include <cstdio>
#include <string.h>
#include <algorithm> using namespace std;
const int maxn=;
char str1[maxn];
char str2[maxn];
int vis[]; int main()
{
scanf("%s %s",str1,str2);
memset(vis,,sizeof(vis));
int len1=strlen(str1),len2=strlen(str2);
for(int i=;i<len1;i++){
if('a'<=str1[i] && str1[i]<='z'){
vis[str1[i]-'a']=;
}
else if('A'<=str1[i] && str1[i]<='Z'){
vis[str1[i]-'A']=; //傻了,之前写成str1[i]-'A'+'a' ....
str1[i]=str1[i]-'A'+'a';//转化成小写,方便后续操作
}
else if(str1[i]=='_'){
vis[]=; //'_'
}
else{
vis[str1[i]-''+]=; //0~9
}
}
for(int i=;i<len2;i++){
if('a'<=str2[i] && str2[i]<='z'){
vis[str2[i]-'a']=;
}
else if('A'<=str2[i] && str2[i]<='Z'){
vis[str2[i]-'A']=;
}
else if(str2[i]=='_'){
//if里面一开始少写了个=。。。导致WA。。。
vis[]=; //'_'
}
else{
vis[str2[i]-''+]=;
}
}
//要按照在str1中的顺序输出,并且是以大写字母的形式
for(int i=;i<len1;i++){
if(str1[i]=='_'){
if(vis[]==){
printf("_");
vis[]=;//输过一次就不需要再输出了
}
}
else if('a'<=str1[i] && str1[i]<='z'){
if(vis[str1[i]-'a']==){
printf("%c",str1[i]-'a'+'A');
vis[str1[i]-'a']=;
}
}
else{
if(vis[str1[i]-''+]==){
printf("%c",str1[i]);
vis[str1[i]-''+]=;
}
}
}
return ;
}

1084. Broken Keyboard (20)-水题的更多相关文章

  1. 1084. Broken Keyboard (20)【字符串操作】——PAT (Advanced Level) Practise

    题目信息 1084. Broken Keyboard (20) 时间限制200 ms 内存限制65536 kB 代码长度限制16000 B On a broken keyboard, some of ...

  2. 1084. Broken Keyboard (20)

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

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

  4. PAT (Advanced Level) 1084. Broken Keyboard (20)

    简单题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...

  5. 【PAT甲级】1084 Broken Keyboard (20 分)

    题意: 输入两行字符串,输出第一行有而第二行没有的字符(对大小写不敏感且全部以大写输出). AAAAAccepted code: #define HAVE_STRUCT_TIMESPEC #inclu ...

  6. pat1084. Broken Keyboard (20)

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

  7. PAT 1084 Broken Keyboard

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

  8. 1084 Broken Keyboard (20 分)

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

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

随机推荐

  1. .netcore部署Linux并结合Nginx反向代理 get started

    一..NetCore网站准备与发布 首先准备好一个ASP.NET Core Web应用程序,我这里就使用新建的示例站点作为demo演示,使用dotnet publish 命令发布网站. 或者使用VS的 ...

  2. leetcode717—1-bit and 2-bit Characters

    We have two special characters. The first character can be represented by one bit 0. The second char ...

  3. Beautiful Soup (一)

    一.Beautiful Soup库的理解 1.Beautiful Soup库可以说是对HTML进行解析.遍历.维护“标签树”的功能库 2.pip install bs4 3.from bs4 impo ...

  4. Underscore.js 入门

    Underscore封装了常用的JavaScript对象操作方法,用于提高开发效率.将它单独运用到任何一个页面.(另外,Underscore还可以被使用在Node.js运行环境.) 在学习Unders ...

  5. SS、SP、BP寄存器

    SS, SP, BP 三个寄存器 SS:存放栈的段地址: SP:堆栈寄存器SP(stack pointer)存放栈的偏移地址; BP: 基数指针寄存器BP(base pointer)是一个寄存器,它的 ...

  6. always on 集群

    准备工作 1.  四台已安装windows server 2008 r2 系统的虚拟机,配置如下: CPU : 1核 MEMORY : 2GB DISK : 40GB(未分区) NetAdapter ...

  7. 自定义View之实现流行的底部菜单栏中间突起:高仿“咸鱼APP”的底部菜单 - z

    http://blog.csdn.net/xh870189248/article/details/75808341 http://blog.csdn.net/yangg194/article/deta ...

  8. 2017-2018 Exp9 网络欺诈技术防范 20155214

    目录 Exp9 网络欺诈技术防范 实验内容 Webgoat General Access Control Flaws Crossing-Site Scripting Injection Flaws 知 ...

  9. 2017-2018-2 20155234『网络对抗技术』Exp6:信息收集与漏洞扫描

    whois查询 whois用来进行域名注册信息查询.以常用的百度为例,输入whois baidu.com可查询到3R注册信息,包括注册人的姓名.组织和城市等信息. 我们可以很清楚地看到baidu的3R ...

  10. 实践:IIS7下访问ashx页面,显示404

    问题描述 1.路径什么的都对,这方面的原因就不要想了 2.在我的电脑上可以,在同事的电脑上不可以 方案1:未注册ashx的处理应用程序 也就是不知道IIS不知道用什么应用程序处理ashx文件,解决办法 ...