1050 String Subtraction(20 分)

Given two strings S​1​​ and S​2​​, S=S​1​​−S​2​​ is defined to be the remaining string after taking all the characters in S​2​​ from S​1​​. Your task is simply to calculate S​1​​−S​2​​ 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 S​1​​ and S​2​​, respectively. The string lengths of both strings are no more than 10​4​​. 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 S​1​​−S​2​​ in one line.

Sample Input:

They are students.
aeiou

Sample Output:

Thy r stdnts.
 #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <map>
#include <stack>
#include <vector>
#include <queue>
#include <set>
#define LL long long
using namespace std;
const int MAX = 1e4 + ; string s1, s2;
int book[MAX] = {}, len1, len2; int main()
{
// freopen("Date1.txt", "r", stdin);
getline(cin, s1);
getline(cin, s2);
len1 = s1.size(), len2 = s2.size();
for (int i = ; i < len2; ++ i) book[s2[i]] = ;
for (int i = ; i < len1; ++ i)
if (!book[s1[i]])
printf("%c", s1[i]);
return ;
}

pat 1050 String Subtraction(20 分)的更多相关文章

  1. PAT 甲级 1050 String Subtraction (20 分) (简单送分,getline(cin,s)的使用)

    1050 String Subtraction (20 分)   Given two strings S​1​​ and S​2​​, S=S​1​​−S​2​​ is defined to be t ...

  2. PAT Advanced 1050 String Subtraction (20 分)

    Given two strings S​1​​ and S​2​​, S=S​1​​−S​2​​ is defined to be the remaining string after taking ...

  3. PAT练习--1050 String Subtraction (20 分)

    题⽬⼤意:给出两个字符串,在第⼀个字符串中删除第⼆个字符串中出现过的所有字符并输出. 这道题的思路:将哈希表里关于字符串s2的所有字符都置为true,再对s1的每个字符进行判断,若Hash[s1[i] ...

  4. 【PAT甲级】1050 String Subtraction (20 分)

    题意: 输入两个串,长度小于10000,输出第一个串去掉第二个串含有的字符的余串. trick: ascii码为0的是NULL,减去'0','a','A',均会导致可能减成负数. AAAAAccept ...

  5. 1050 String Subtraction (20分)

    Given two strings S​1​​ and S​2​​, S=S​1​​−S​2​​ is defined to be the remaining string after taking ...

  6. PAT 解题报告 1050. String Subtraction (20)

    1050. String Subtraction (20) Given two strings S1 and S2, S = S1 - S2 is defined to be the remainin ...

  7. PAT 1050 String Subtraction

    1050 String Subtraction (20 分)   Given two strings S​1​​ and S​2​​, S=S​1​​−S​2​​ is defined to be t ...

  8. PAT (Advanced Level) 1050. String Subtraction (20)

    简单题. #include<iostream> #include<cstring> #include<cmath> #include<algorithm> ...

  9. PAT甲题题解-1050. String Subtraction (20)-水题

    #include <iostream> #include <cstdio> #include <string.h> #include <algorithm&g ...

随机推荐

  1. C++ 利用template给函数中的变量赋初值

    #include <iostream> template<int base> void echo(int add) { int sum=add+base; std::cout& ...

  2. JavaScript七宗罪和一些槽点

    当下JavaScript越来越流行,成为长期霸语言榜前三的语言.但是实际上JavaScript是一个很丑陋有很多槽点的语言,这就是为什么新出了那么多框架(从jQuery到Vue)以及海尔斯伯格大大推出 ...

  3. ESP8266开发之旅 基础篇⑥ Ticker——ESP8266定时库

    授人以鱼不如授人以渔,目的不是为了教会你具体项目开发,而是学会学习的能力.希望大家分享给你周边需要的朋友或者同学,说不定大神成长之路有博哥的奠基石... QQ技术互动交流群:ESP8266&3 ...

  4. Mobius反演学习

    这篇文章参考了许多资料和自己的理解. 先放理论基础. 最大公约数:小学学过,这里只提一些重要的公式: $·$若$a=b$,则$\gcd(a,b)=a=b$: $·$若$\gcd(a,b)=d$,则$\ ...

  5. vue render

    Vue 的 render 渲染 API vue2 的 vnode tag: 当前节点的标签名 data: 当前节点是数据对象 children: 子节点,数组也是vnode 类型 text: 当前节点 ...

  6. ESP8266 打造一款物联网产品---搭建环境编译及烧录

    一 前记 作为一个在wifi领域耕耘了多年的人,以前一直在外企和大公司做芯片,没有怎么使用过国内的芯片公司做出来的芯片.最近正好有一个项目需要用到一款低成本的wifi芯片,找来找去,发现乐鑫的最适合. ...

  7. axio安装及使用

    先安装 npm install axios --save 再导入 import $ from "jquery"; import axios from "axios&quo ...

  8. networkx整理

    1.基础知识 1.1.介绍 networkx在2002年5月产生,是一个用Python语言开发的图论与复杂网络建模工具,内置了常用的图与复杂网络分析算法,可以方便的进行复杂网络数据分析.仿真建模等工作 ...

  9. 数据文件包解析工具类 RandomAccessFile

    public class ReadTextFile { public static void main(String[] args) { pic2txt(); parseFrmFile(); //ur ...

  10. java常用类Time

    LocalDate:IOS格式(yyyy-MM-dd)日期 LocalTime:表示一个时间 LocalDateTime:表示时间日期 Instant 时间线上的瞬时点,可以用来记录应用程序中的时间时 ...