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 ...
随机推荐
- [JavaScript] - replaceAll,将字符串中的字母或数字等全部替换掉的方式
原题 function DNAtoRNA(dna) { // create a function which returns an RNA sequence from the given DNA se ...
- burp suite 的intruder 四种攻击方式
一:sniper[狙击手] 这种攻击基于原始的请求内容,需要一个字典,每次用字典里的一个值去代替一个待攻击的原始值. 攻击次数=参数个数X字典内元素个数 例如:原始请求中 name=aa , pass ...
- python 加密
https://github.com/duanhongyi/gmssl
- NoSQL(not only struts query language)的简单介绍
为什么需要NoSQL? 互联网自扩大规模来一直面临3个问题 1.High performance高并发 一个网站开发实时生成动态页面可能会存在高并发请求的需求,硬盘IO已经无法接受 2.Huge St ...
- ado_基本连接操作【四】
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data. ...
- [转][C++]佛祖保佑,永无bug。C++ BUG解决方案
// // _oo0oo_ // o8888888o // 88" . "88 // (| -_- |) // 0\ = /0 // ___/`---'\___ // .' \\| ...
- anusplina 4.36版本使用提示 说明
1),必须要注意的是,你生成的dat文件中,第一列必须是气象站点编号:第二列必须是经度数值,而且是投影坐标下,以 米 为单位:第三列必须是纬度了:第四列必须是海拔了:之后就是你自己的数据,比如平均温度 ...
- 基于python Arcface 实现人脸检测和识别
虹软的人脸识别技术也是很强的,重要的是他免费提供了离线的sdk,还提供了实例,这个是目前几家研究人脸识别的大公司里面少有的.识别能力正常用还是可以的.我这个代码是调用的离线sdk实现的 ``` fro ...
- 认识flask框架-2
1.json:基于键值对的字符串,轻量级的数据交互格式,用来传输数据 2.json模块 dumps:把字典转化成json字符串. loads:把json字符串转成字典. dump.load操作的是文件 ...
- @Value注解分类解析
1.1.1 @Value注解 @Value的作用是通过注解将常量.配置文件中的值.其他bean的属性值注入到变量中,作为变量的初始值. (1)常量注入 @Value(" ...