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 ...
随机推荐
- Java基础【基本数据类型包装类、int与String 之间的相互转换】
为什么会有基本类型包装类? 将基本类型数据类型封装成对象,这样的好处可以在对象中定义更多方法操作该数据. 包装类常用的操作就是用于基本数据类型与字符串之间的转换 问题:int a=100; 为什么不能 ...
- Couldn't import dot_parser, loading of dot files will not be possible. 解决方法
参考: pydot and graphviz error: Couldn't import dot_parser, loading of dot files will not be possible ...
- 【NOIP 2016】Day2 T3 愤怒的小鸟
Problem Description \(Kiana\) 最近沉迷于一款神奇的游戏无法自拔. 简单来说,这款游戏是在一个平面上进行的. 有一架弹弓位于 \((0,0)\) 处,每次 \(Kiana\ ...
- Lintcode455-StudentID-Easy
Implement a class Class with the following attributes and methods: A public attribute students which ...
- 线程间操作无效: 从不是创建控件“button2”的线程访问它
在项目中经常遇到类似的问题,如何解决呢,报错的方法中添加 Control.CheckForIllegalCrossThreadCalls = false; 就可以解决了.
- ImgNoGoodWindow
using System;using System.Collections.Generic;using System.Linq;using System.Text;using UnityEditor; ...
- 同上两篇 这篇是关于shader的
资源加载性能测试代码 与上篇所提出的测试代码一样,我们对于Shader资源的加载性能分析同样使用该测试代码.同时,我们将Shader文件制作成一定大小的AssetBundle文件,并逐一通过以下代码在 ...
- OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000083e80000, 1366294528, 0) failed;
我是在手动搭建nexus时遇到的 安装nexus时 启动命令的时候会报OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000 ...
- CentOS6.5下搭建LAMP+FreeRadius+Daloradius Web管理和TP-LINK路由器、H3C交换机连接,实现,上网认证和记账功能
什么是RADIUS服务: RADIUS:(Remote Authentication Dial In User Service)中文名为远程用户拨号认证服务,简称RADIUS,是目前应用最广泛的AAA ...
- 【C#】 基于ArcFace 2.0—视频人脸识别Demo
使用的虹软人脸识别技术 啥话不说,不用跪求,直接给下载地址:http://common.tenzont.com/comdll/arcface2demo.zip(话说附件的大小不限制,还是说我的文件太大 ...