#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. 2018.08.31 16:26 调试 Swift 和 Pycharm 与 github 之间的链接

    花了一段时间调试Swift和Pycharm的链接,网上查了一下有关信息,再加上自己的摸索,一会就掌握了.

  2. swift和oc的protocol的成员变量

    都需要协议实现者提供具体变量: 否则认为不符合协议. @protocol edddd <NSObject> @property(nonatomic, strong) NSObject *e ...

  3. VC基于单文档OpenGL框架

    本文是在VC6.0的环境下,运用MFC实现的OpenGL最基本框架,需要简单了解MFC编程(会在VC6.0里创建MFC单文档应用程序就行),甚至不必了解OpenGL的知识.以下是具体的步骤. 1.创建 ...

  4. python json 解析

    Encode过程,是把python对象转换成json对象的一个过程,常用的两个函数是dumps和dump函数. dic1 = {'type':'dic1','username':'loleina',' ...

  5. FFmpeg编程学习笔记二:音频重採样

    ffmpeg实现音频重採样的核心函数swr_convert功能很强大,但是ffmpeg文档对它的凝视太过简单.在应用中往往会出这样那样的问题,事实上在读取数据->重採样->编码数据的循环中 ...

  6. OutputFormat输出过程的学习

    花了大约1周的时间,最终把MapReduce的5大阶段的源代码学习结束掉了.收获不少.就算本人对Hadoop学习的一个里程碑式的纪念吧.今天花了一点点的时间,把MapReduce的最后一个阶段.输出O ...

  7. SpingMVC的<context:component-scan>包扫描踩坑记录

        公司项目配置的Spring项目的包扫描有点问题,出现了一个被Spring容器管理的Bean被创建了2次的现象.在此记录下解决的过程,方便后续查阅. 改动前: 容器启动监听器中会扫描全部包,创建 ...

  8. Tarjan&&缩点简析

    由于昨天写计蒜客初赛的一道题,看出了是缩点,但一时忘记了另外一个叫什么s...的算法怎么写了,话说我为什么没有回去翻一下自己的blog然后今天就去学了更实用也更强力的Tarjan Tarjan的思想其 ...

  9. ajax传递数组给controller的实现方法和坑

    这里是前端向后端传递一个数组的方式,参考下面这个示例: (主要是将前端的数组,用 JSON.stringify() 方法json化一下,然后后端springmvc接收到以后,使用 JSONArray  ...

  10. R绘图 第六篇:绘制线图(ggplot2)

    线图是由折线构成的图形,线图是把散点从左向右用直线连接起来而构成的图形,在以时间序列为x轴的线图中,可以看到数据增长的趋势. geom_line(mapping = NULL, data = NULL ...