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 104. 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<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的更多相关文章
- 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
		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 ... 
- PAT甲级——A1050 String Subtraction
		Given two strings S1 and S2, S=S1−S2 is defined to be the remaining string after taking ... 
- 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 ... 
- PAT练习--1050 String Subtraction (20 分)
		题⽬⼤意:给出两个字符串,在第⼀个字符串中删除第⼆个字符串中出现过的所有字符并输出. 这道题的思路:将哈希表里关于字符串s2的所有字符都置为true,再对s1的每个字符进行判断,若Hash[s1[i] ... 
- 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
		1050 String Subtraction (20 分) Given two strings S1 and S2, S=S1−S2 is defined to be t ... 
- pat 1050 String Subtraction(20 分)
		1050 String Subtraction(20 分) Given two strings S1 and S2, S=S1−S2 is defined to be the ... 
随机推荐
- js动态删除行错误
			Uncaught TypeError: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'. js ... 
- POJ 3087:Shuffle'm Up
			Shuffle'm Up Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7364 Accepted: 3408 Desc ... 
- 吴裕雄--天生自然 JAVASCRIPT开发学习:HTML DOM 集合(Collection)
			<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ... 
- Django1.11创建
			Djiango 1.11.1 虚拟环境配置 创建虚拟环境 mkvirtualenv 虚拟环境名字 -p python3 安装django pip install django==1.11.11 卸载包 ... 
- css伪元素::before与::after使用基础示例
			1.指定文本前后添加内容 <div class="box">test</div> .box::before{ content: 'before'; marg ... 
- 17.3.10--关于C元的变量类型所占字节问题和类型转化
			在C语言并没有对于严格规定short,int long所占字节,只是做了宽泛要求:short:至少连个字节 int建议为一个机器字长,32位环境下机器字长是4个字节,64位环境机器字长是8个字节 s ... 
- JQuery  点击子控件事件,不会触发父控件的事件
			$('.order-delete').on('tap', function (e) { console.log('删除1'); c ... 
- 二、提高期(Upping the Ante)
			二.提高期(Upping the Ante) Upping the Ante?这可是第四阶段的词.没办法,Greg Thomson用这个词代表第二阶段,看着喜欢,继续沿用. 经过两三个月的“图象+声音 ... 
- 1. Ruby基础知识
			1. Ruby执行选项 符号 作用 -c 检查代码正确性 -w 警告模式运行 -e 字面脚本 -l 行模式运行 单独 ruby -c Hello.rb 组合 ruby -le 'print " ... 
- long型长整数字在前端页面显示异常及其解决方法
			文章目录 1.引子 2.解决问题 (1)初试EL表达式取long型数值 (2)再探EL表达式取字符串格式long型数值 (3)最后一试---给EL表达式加引号 3.总结 1.引子 在做项目中,发现了一 ... 
