#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. centos中,tomcat项目创建文件的权限

    参考文章:https://cloud.tencent.com/info/5f02caa932fd6dbfc46a3bb01af135e0.html 我们在centos中输入umask,会看到输出002 ...

  2. PyQt5--QCalendar

    # -*- coding:utf-8 -*- ''' Created on Sep 20, 2018 @author: SaShuangYiBing Comment: ''' import sys f ...

  3. jquery实现返回页面顶部功能。

    <p id="back-to-top"> <span></span> </p> <script type="text ...

  4. initialProps被React-Navigation的navigation属性覆盖解决方案

    怎么开场对我来说一个是个很纠结的问题,Emmm这应该算个好开场. 最近在做一个RN的app端调试工具,在把它嵌入原生app中的时候遇到了一个问题,RN组件里面接受不到原生传过来的initialProp ...

  5. python第三十八课——面向对象(一)

    1.面向对象:(思想) 面向:看.关注.瞅 对象:个体.实体.实例.结果单词:object在python中一些皆对象 面向过程:(思想) 面向:看.关注.瞅 过程:经过.经历.从头到尾 使用一些生活中 ...

  6. 日常使用Shell积累

    HDFS统计文件行数: hdfs dfs -cat hdfs://ns3/wordcount/* |wc -l

  7. laravel扩展推荐

    1. Intervention/image 图片处理 2.Laravel User Agent 轻松识别客户端信息 3.OAuth 2.0 支持 4.页面面包屑工具 5.计划任务分发器(直接可替换掉 ...

  8. Solr建立索引时,过滤HTML标签

    原文地址  http://www.joyphper.net/article/201306/188.html 1.在数据库的读取文件data-config.xml 中的entity 标记里边添加 tra ...

  9. 理解RHEL上安装oracle的配置参数 :/etc/security/limits.conf, /etc/profile, /etc/pam.d/login

    无论安装什么版本的Oracle,在安装之前,都需要配置 /etc/pam.d/login   /etc/profile   /etc/security/limits.conf这三个文件 那这三个文件究 ...

  10. VS一些快捷键

    参考网址:http://www.open-open.com/lib/view/open1412261028453.html (这里省去了很多大家闭上眼都会操作的什么Ctrl+S 等等操作 给出的大多是 ...