题目链接
这道题手下留情了, 只用 散列 就可以做出来, 基本上没什么坑点.
所谓不动脑, 就是说能用库函数解决的 , 就全用库函数解决, 代码越短越好。
AC代码如下 , 思路很简单。
#include <cstdio>
#include <string>
#include <iostream>
#include <cctype>
using namespace std;
int main(){
string want, actual;
getline(cin, want);
getline(cin, actual);
int hash1[300]={0};
for (auto &x:actual){
if (islower(x)) x=toupper(x);
hash1[x]=1;
}
for (auto &x:want){
if (islower(x)) x=toupper(x);
if (hash1[x]==0){
printf("%c",x);
hash1[x]=1;
}
}
}