#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. 自定义上传控件(兼容IE8)

    上传控件是 <input type="file"/> 而实际开发过程中,都会自定义一个控件,因为这个控件本身难看,而且不同浏览器效果不一样. 如IE8显示如下: 谷歌浏 ...

  2. laravel的Eloquent中的get()和Query/Builder中的get()

    Eloquent 中的get实际上是Eloquent/Builder中的get,得到的结果是个Collection对象,再调用Collection的first才得到collection中的一项,即一个 ...

  3. Vue那些事儿之用visual stuido code编写vue报的错误Elements in iteration expect to have 'v-bind:key' directives.

    当用vsc打开我们的vue代码时,在其他编辑器里面本来没有错误,到这个编辑器里面 v-for就出毛病了.如下图所示, 那是因为我们打开了对vue进行Eslint的检查. 搜索vetur.validat ...

  4. Linq EF 添加数据执行事务处理

    在EF4.1的DBContext中实现事务处理(BeginTransaction)和直接执行SQL语句的示例 2012-12-12 10:39             5538人阅读          ...

  5. 借助强大的IDEA开发ide高效实现equals,hashcode以及toString方法

    IDEA工具提供多种生成hashCode与equals的代码方案,注意:尽量不要使用第一个方案,第一个方案对于null不做判空处理,容易NNP问题. 对于生成toString方法方案,默认使用的是+拼 ...

  6. oracle11g dataguard 备库数据同步的检查方法

    概述: 一.环境      主库:       ip地址:192.168.122.203       oracle根目录:/data/db/oracle       SID:qyq       数据文 ...

  7. JS编写日历控件(支持单日历 双日历 甚至多日历等)

    前言: 最近几天都在研究日历控件编写,当然前提我要说明下,当然看过别人写的源码 所以脑子一热 就想用自己的编码方式 来写一套可扩展性 可维护性 性能高点的代码控件出来,就算练习练习下,所以前几天晚上下 ...

  8. PAT B1007 素数对猜想 (20 分)

    让我们定义d​n​​为:d​n​​=p​n+1​​−p​n​​,其中p​i​​是第i个素数.显然有d​1​​=1,且对于n>1有d​n​​是偶数.“素数对猜想”认为“存在无穷多对相邻且差为2的素 ...

  9. Android 将拼接好并加上边框的图片保存到内存卡中

    通过前两篇文章,问们学会了怎样拼接图片.给拼接好的图片加上边框样式,但这还不够,忙活了大半天 终于拼接好并给图片美化了,但是程序一旦推出,之前做的工作都白费了.这时我们会想,能不能把拼接好的图片保存起 ...

  10. 大数据入门第二十二天——spark(二)RDD算子(2)与spark其它特性

    一.JdbcRDD与关系型数据库交互 虽然略显鸡肋,但这里还是记录一下(点开JdbcRDD可以看到限制比较死,基本是鸡肋.但好在我们可以通过自定义的JdbcRDD来帮助我们完成与关系型数据库的交互.这 ...