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.

分析:散列,水题,用map映射比较快

 /**
 * Copyright(c)
 * All rights reserved.
 * Author : Mered1th
 * Date : 2019-02-25-21.03.43
 * Description : A1050
 */
 #include<cstdio>
 #include<cstring>
 #include<iostream>
 #include<cmath>
 #include<algorithm>
 #include<string>
 #include<unordered_set>
 #include<map>
 #include<vector>
 #include<set>
 using namespace std;

 int main(){
 #ifdef ONLINE_JUDGE
 #else
     freopen("1.txt", "r", stdin);
 #endif
     string a,b;
     getline(cin,a);
     getline(cin,b);
     map<char,int> mp;
     ;i<b.length();i++){
         mp[b[i]]++;
     }
     ;i<a.length();i++){
         ){
             printf("%c",a[i]);
         }
     }
     ;
 }

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. 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 ...

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

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

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

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

  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. 1050. String Subtraction (20)

    this problem  is from PAT, which website is http://pat.zju.edu.cn/contests/pat-a-practise/1050. firs ...

  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 ...

  10. A1050 String Subtraction (20 分)

    一.技术总结 这个是使用了一个bool类型的数组来判断该字符是否应该被输出. 然后就是如果在str2中出现那么就判断为false,被消除不被输出. 遍历str1如果字符位true则输出该字符. 还有需 ...

随机推荐

  1. 《Effective Java 第二版》读书笔记

    想成为更优秀,更高效程序员,请阅读此书.总计78个条目,每个对应一个规则. 第二章 创建和销毁对象 一,考虑用静态工厂方法代替构造器 二, 遇到多个构造器参数时要考虑用builder模式 /** * ...

  2. 攻防:文件上传漏洞的攻击与防御,转自H3C

    WebShell就是以asp.php.jsp或者cgi等网页文件形式存在的一种命令执行环境,也可以将其称做为一种网页后门.黑客在入侵了一个网站后,通常会将这些asp或php后门文件与网站服务器WEB目 ...

  3. sprintf 函数

    //$tick 保留{$decimalplaces}位小数,不够位数的小数点后面用0 填充$tick = sprintf( "%.0${decimalplaces}lf ", $i ...

  4. linux 优化git操作速度

    修改 ssh配置:useDNS:no

  5. SWIFT中获取当前经伟度

    很多的APP中都会用到用户的当前位置信息,本文将实现这个小功能 import UIKit import CoreLocation //添加引用 class ViewController: UIView ...

  6. string用scanf读入(节省时间)

    #include <iostream> #include <stdio.h> #include <string.h> using namespace std; in ...

  7. WEB接口测试之Jmeter接口测试自动化 (二)

    通过逐个录入的方式,好不容易将需要测试几十个接口的300多个测试用例录入sampler-http请求中,固定的测试环境跑起来也还 感觉良好.不料在新服务器环境中跑用例时,问题来了:修改参数维护脚本等成 ...

  8. 为什么在开发中大部分的时候都在用session而Application基本上都不去使用?

    问题描述 为什么在开发中大部分的时候都在用session而Application基本上都不去使用? 为什么在开发中大部分的时候都在用session而Application基本上都不去使用?为什么在开发 ...

  9. nmap扫描时的2个小经验

    http://pnig0s1992.blog.51cto.com/393390/367558/ 1.我肉鸡的环境是Windows XP sp3,在使用nmap扫描外网的时候,提示我 pcap_open ...

  10. 【vue】Mac上安装Node和NPM

    http://bubkoo.com/2017/01/08/quick-tip-multiple-versions-node-nvm/ 作为前端开发者,node和npm安装必不可少.然而有时会因为安装新 ...