首页 > 其他 > 详细

1029 旧键盘

时间:2020-02-18 12:30:16      阅读:50      评论:0      收藏:0      [点我收藏+]

水题。与B1093 字符串A+B 类似。

#include<iostream>
#include<cctype>
using namespace std;
 
bool  hashtable[300] = {false};
int main() {
    string str1,str2;
    cin>>str1>>str2;
    for(int i = 0; i < str1.size(); ++i)//把str1,str2的小写字母转成大写字母
        if(islower(str1[i]))
            str1[i]-=32;
    for(int i = 0; i < str2.size(); ++i) {
        if(islower(str2[i]))
            str2[i]-=32;
        hashtable[str2[i]] = true; //标记非坏键 
    }
    for(int i = 0; i < str1.size(); ++i) {
        if(hashtable[str1[i]] == false) { 
            cout<<str1[i];//输出坏键
            hashtable[str1[i]] = true;//标记已访问 
        }
    }
    return 0;
}

技术分享图片

 

1029 旧键盘

原文:https://www.cnblogs.com/keep23456/p/12325582.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!