1050 String Subtraction

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<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;

int main()
{
//	freopen("C://坚果云//算法//String Subtractionin.txt","r",stdin);
//	freopen("C://坚果云//算法//String Subtractionout.txt","w",stdout);
	bool b[1000];
	string a,c;
	getline(cin,a);
	getline(cin,c);
	for(int i=0;i<1000;i++)
	{
		b[i]=true;
	}
	for(int j=0;j<c.length();j++)
	{
				b[c[j]]=false;
	}
	for(int j=0;j<a.length();j++)
	{
		if(b[a[j]]==true)
		{
			printf("%c",a[j]);

		}
	}
//	fclose(stdin);
//	fclose(stdout);
	return 0;
}

PAT甲级——1050 String Subtraction的更多相关文章

  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 甲级 1050 String Subtraction

    https://pintia.cn/problem-sets/994805342720868352/problems/994805429018673152 Given two strings S~1~ ...

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

  4. PAT甲级——A1050 String Subtraction

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

  5. PAT Advanced 1050 String Subtraction (20) [Hash散列]

    题目 Given two strings S1 and S2, S = S1 – S2 is defined to be the remaining string afer taking all th ...

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

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

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

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

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

  9. pat 1050 String Subtraction(20 分)

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

随机推荐

  1. faster RCNN(keras版本)代码讲解(3)-训练流程详情

    转载:https://blog.csdn.net/u011311291/article/details/81121519 https://blog.csdn.net/qq_34564612/artic ...

  2. google docker镜像下载

    https://anjia0532.github.io/2017/11/15/gcr-io-image-mirror/

  3. CTF -攻防世界-misc新手区

    此题flag题目已经告诉格式,答案很简单. 将附件下载后,将光盘挂到虚拟机启动 使用 strings linux|grep flag会找到一个O7avZhikgKgbF/flag.txt然后root下 ...

  4. 201703-1 分蛋糕 Java

    思路: 注意最后如果剩余蛋糕的重量小于k,也算一个人分到 import java.util.Scanner; public class Main { public static void main(S ...

  5. java将HSSFWorkbook生成的excel压缩到zip中

    思路:1.写入输入流中. 2.将输入流加到ZipOutputStream压缩流中 List<DocumentModel> list = null; try { list = documen ...

  6. nginx 负载策略

    1.轮询(weight=1) 默认选项,当weight不指定时,各服务器weight相同,每个请求按时间顺序逐一分配到不同的后端服务器,如果后端服务器down掉,能自动剔除. upstream bak ...

  7. not in 优化 NOT EXISTS替代

    优化前 SELECT id, loan_id, NAME FROM xw_baoxian_interchange WHERE , , ) , ) AND loan_id NOT IN ( SELECT ...

  8. HTTP Error 500.30 - ANCM In-Process Start Failure错误。.NET Core

    调试.NET Core项目.出现了以下的错误.学网上搞了好久IIS没卵用.然后根据微软的提示,解决了问题. 解决方法: 1. 目标平台换成Any  CPU 2.点击工具-获取工具和功能,把下面这个II ...

  9. 17.3.12----OS模块ya

    1---他是一xu个python系统编程的操作模块,可以处理文件和目录这些我们日常手动需要做的操作. import os#导入这个os模块,其实python模块就是C元的包含很多函数的文件 2---o ...

  10. Innodb-内存架构与特性

    参考文档 Innodb特性buffer_pool http://mysql.taobao.org/monthly/2017/05/01/?spm=a2c4e.11153940.blogcont2812 ...