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. 编写检测深度模型测试程序python

    参考:https://blog.csdn.net/haoji007/article/details/81035565?utm_source=blogxgwz9 首先从网上下载imagenet训练好的模 ...

  2. JS向固定数组中添加不重复元素并冒泡排序

    向数组{7,20,12,6,25}中添加一个不重复的数字,然后按照从小到大的顺序排列 源代码: <!DOCTYPE html> <html> <head> < ...

  3. Python说文解字_Python之多任务_04

    问:并发.并行.同步.异步.阻塞.非阻塞 答: 并发.并行: 并发是指一个时间段内(不是指的时间点),有几个程序在同一个CPU上运行,但是任意时刻只有一个程序在CPU上运行.对人类的时钟来说1秒钟能干 ...

  4. Python之路,Day1 - Python基础1 介绍、基本语法、流程控制

    本节内容 1.python介绍 2.发展史 3.python 2.x or python 3.x ? 4.python 安装 5.第一个程序 Hello World 程序 6.变量 7.用户输入 8. ...

  5. Vue-router(5)之 路由的before家族

    beforeEach方法 import Vue from 'vue' import Router from 'vue-router' import Son1 from '@/view/New/son1 ...

  6. 京东云入选2019年度TOP100全球软件案例 新一代服务治理框架加速行业落地

    11月14日-17日, 2019TOP100全球软件案例研究峰会(TOP100summit)在北京国家会议中心举办.Top100summit是科技界一年一度的案例研究峰会,每年会秉承"从用户 ...

  7. 4)栈和队列-->受限线性表

    栈和队列叫  受限线性表  只不过他们插入和删除的位置  相对于之前的线性表有了限制   所以叫受限线性表 1)栈-->就是先进后出 2)队列-->先进先出 3)循环链表框图: 4)队列

  8. MySQL--通过.frm和.ibd对mysql数据恢复

    转载:http://bbs.csdn.net/topics/392114182 例如说 现在要恢复user表1.先建立和之前user表一样的表结构.就是执行create table user .... ...

  9. Java--二维码生成&图片和流转化

    package test; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java. ...

  10. h5-FileReader对象的使用

    <!--FileReader对象的使用--> <!--需要及时预览 及时:当用户选择完图片之后就立即进行预览处理--onchange事件 预览:通过文件读取对象的readAsData ...