#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
using namespace std;
int book[1000]={0};
int main()
{
// freopen("in.txt","r",stdin);
queue<char> q1,q2;
char ch;
while( (ch=getchar())!='\n' )
q1.push(ch);
while( (ch=getchar())!=EOF )
{
if(ch=='\n')//吸收掉最后一个回车键,虽然不加对此题也没有影响,但是最好加上
break;
q2.push(ch);
}
while(!q1.empty())
{
if(q1.front()!=q2.front())
{
int t=q1.front();
if(q1.front()>='a' && q1.front()<='z')
t=t-32;
if(book[t]==0)
{
printf("%c",t);
book[t]++;
}
q1.pop();
}
else
{
q1.pop();
q2.pop();
}
}
return 0;
}
1084. Broken Keyboard (20)
最新推荐文章于 2022-09-01 23:04:18 发布
本文通过一个C++程序实例展示了如何使用标准库中的队列进行字符输入的接收与对比操作,并实现特定条件下的字符输出。该程序首先从标准输入读取两组字符到不同的队列中,然后逐个比较队列中的字符,对于不匹配的字符,如果满足特定条件则输出。

1523

被折叠的 条评论
为什么被折叠?



