PAT 1050 String Subtraction
Given two strings S1 and S2, S=S1−S2 is defined to be the remaining string after taking all the characters in S2 from S1. Your task is simply to calculate S1−S2 for any given strings. However, it might not be that simple to do it fast.
Input Specification:
Each input file contains one test case. Each case consists of two lines which gives S1 and S2, respectively. The string lengths of both strings are no more than 1. It is guaranteed that all the characters are visible ASCII codes and white space, and a new line character signals the end of a string.
Output Specification:
For each test case, print S1−S2 in one line.
Sample Input:
They are students.
aeiou
Sample Output:
Thy r stdnts.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAXN 10005 map<char,int> mp;
vector<char> vec; int main(){
string s1,s2;
getline(cin,s1);
getline(cin,s2); for(int i=;i < s2.size();i++){
mp[s2[i]]++;
} for(int i=;i < s1.size();i++){
if(!mp[s1[i]]) cout << s1[i];
}
return ;
}
——
PAT 1050 String Subtraction的更多相关文章
- pat 1050 String Subtraction(20 分)
1050 String Subtraction(20 分) Given two strings S1 and S2, S=S1−S2 is defined to be the ...
- PAT 解题报告 1050. String Subtraction (20)
1050. String Subtraction (20) Given two strings S1 and S2, S = S1 - S2 is defined to be the remainin ...
- PAT 甲级 1050 String Subtraction (20 分) (简单送分,getline(cin,s)的使用)
1050 String Subtraction (20 分) Given two strings S1 and S2, S=S1−S2 is defined to be t ...
- PAT甲级——1050 String Subtraction
1050 String Subtraction Given two strings S1 and S2, S=S1−S2 is defined to be the remain ...
- 1050 String Subtraction (20 分)
1050 String Subtraction (20 分) Given two strings S1 and S2, S=S1−S2 is defined to be the ...
- PAT (Advanced Level) 1050. String Subtraction (20)
简单题. #include<iostream> #include<cstring> #include<cmath> #include<algorithm> ...
- PAT甲题题解-1050. String Subtraction (20)-水题
#include <iostream> #include <cstdio> #include <string.h> #include <algorithm&g ...
- PAT 甲级 1050 String Subtraction
https://pintia.cn/problem-sets/994805342720868352/problems/994805429018673152 Given two strings S~1~ ...
- PAT Advanced 1050 String Subtraction (20 分)
Given two strings S1 and S2, S=S1−S2 is defined to be the remaining string after taking ...
随机推荐
- 【C#】委托的发展
"用事件去处理程序, 进而解决问题" ---- 委托的目的 委托早在C#2的时候就已经初具模型, 但是并不是特别灵活, 制止C#3才在代码中被广泛使用. C#4中泛型委托, C#5 ...
- Kubenets 调试cronjob
kubectl exec -ti dvm-dailyreport-debug-deployment-86c55496dc-2mzjz -n alpha /bin/bash # 进入namespace: ...
- 【二十九】php之简易微信二维码支付
参考二维码支付接口文档:https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_5 index.php <!DOCTYPE htm ...
- Python安装常见问题:zipimport.ZipImportError: can't decompress data; zlib not available 解决办法
centos7安装python3.7.2时,报错,解决如下 yum -y install zlib* 参考: https://blog.csdn.net/u014749862/article/deta ...
- [HTML]html读取本地文件并显示
<html> <body> <script script type="text/javascript"> function show() { v ...
- eclipse安装失败
在eclipse下载后第一次运行eclipse出现如下错误,刚打开后就退出并返回code=13,最后发现 是eclipse的安装版本是64bit,但是jdk的版本是基于32bit的所以出现上面的错误, ...
- python使用sessions模拟登录淘宝
之前想爬取一些淘宝的数据,后来发现需要登录,找了很多的资料,有个使用request的sessions加上cookie来登录的,cookie的获取在登录后使用开发者工具可以找到.不过这个登录后获得的网页 ...
- Flask请求上下文request
- 牛客OI周赛4-提高组 C 战争(war)
战争(war) 思路: 二分答案, 找到第一个不满足条件的位置 首先对于一个值来说, 所有这个值的区间肯定有交区间, 然后在这个交区间内不能出现比它小的数 所以我们check时从大的值开始考虑, 求出 ...
- php后台操作以及一些减缓服务器压力的问题
上次提到一个微信投票系统,做了一个微信重定向解决了,一个授权复用的问题,昨天投票系统正式投入使用:测试的时候没有问题,上线后出现了一点小问题, 一:php页面参数接受和php中 switch 那个先执 ...