团体程序设计天梯赛 L1-011 A-B

L1-011 A-B

题目链接-L1-011 A-B
在这里插入图片描述
解题思路
for循环,如果在b字符串中找不到a[i]就输出

觉得这道题比较水的可以去看看这两道题
一样的思路,个人觉得难度依次递增
PAT-旧键盘
PAT-旧键盘打字

附上代码

#include<bits/stdc++.h>
#define int long long
#define lowbit(x) (x &(-x))
using namespace std;
const int INF=0x3f3f3f3f;
const double PI=acos(-1.0);
const double eps=1e-10;
const int M=1e9+7;
const int N=1e5+5;
typedef long long ll;
typedef pair<int,int> PII;
string a,b;
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	
	getline(cin,a);
	getline(cin,b);
	for(int i=0;i<a.length();i++){
		if(b.find(a[i])==string::npos)
			cout<<a[i];
	}
	return 0;
}
发布了123 篇原创文章 · 获赞 9 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/Fiveneves/article/details/104846928
今日推荐