首页 > 学院 > 开发设计 > 正文

1084. Broken Keyboard (20)

2019-11-08 01:46:57
字体:
来源:转载
供稿:网友

浪费一个数组空间来存储是否已被输出

#include<cctype>#include<iostream>#include<string>#include<set>using namespace std;int main(){ int visited[1000] = {}; string a, b; getline(cin, a); getline(cin, b); set<char> q;//存储输出的字符 for (auto x : b) q.insert(toupper(x)); for (auto x : a)//对第一行的字符串进行逐个解析 if (q.find(toupper(x)) == q.end() && visited[toupper(x)]==0) { PRintf("%c",toupper(x)); visited[toupper(x)] = 1; } cout << endl;}
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表