1050. String Subtraction (20)

时间限制
10 ms
内存限制
65536 kB
代码长度限制
16000 B
判题程序
Standard
作者
CHEN, Yue

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<algorithm>
#include<iostream>
#include<cstring>
#include<queue>
#include<vector>
#include<cmath>
#include<string>
#include<map>
#include<set>
using namespace std;
bool ha[];//ACSII码范围 0-127
int main(){
//freopen("D:\\INPUT.txt","r",stdin);
string s1,s2,s3;
getline(cin,s1);
getline(cin,s2);
int i;
for(i=;i<s2.length();i++){
ha[s2[i]]=true;
}
s3="";
for(i=;i<s1.length();i++){
if(!ha[s1[i]]){
s3=s3+s1[i];
}
}
cout<<s3<<endl;
return ;
}

pat1050. String Subtraction (20)的更多相关文章

  1. PAT---1050. String Subtraction (20)

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

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

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

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

  4. 1050. String Subtraction (20)

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

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

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

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

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

  7. A1050 String Subtraction (20 分)

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

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

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

随机推荐

  1. C#多线程 线程嵌套调用问题

    线程嵌套指的是:线程A的执行代码启动了线程B,线程B的执行代码又启动了线程C. 我原本以为线程A被Abort后,线程B会自动被Abort,但是我大错特错了. 在这种场景下,线程的管理就非常重要了. 线 ...

  2. 类的继承与super()的意义以即如何写一个正确的异常类

    这些东西都是我看了许多名师课程和自己研究的成果,严禁转载,这里指出了如何正确的自己定义一个异常类并看一看sun写的java的源代码话题一:子类的构造器执行是否一定会伴随着父类的构造执行? 1.this ...

  3. C#内存映射大文件并使用Marshal解析结构体信息

    内存映射数据处理类主要函数及变量如下: string _filepath; /// <summary> /// 引用内存映射文件 /// </summary> private ...

  4. C# 顺序表---增删改查--逆至--删除最小值

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  5. vs code进行c/c++开发

    vs code是微软公司开发的跨平台编辑器,丰富的插件功能可以满足各种编程语言的编码,编译和调试.由于vs code本身只是一个编辑器,所以你需要准备编译工具链.本文针对的是windows系统,我这里 ...

  6. JavaEE常用开发工具分享

    链接:https://pan.baidu.com/s/1Jxd2Y45LhWAUHc8-dM_ukw 提取码:h50f

  7. P2253 好一个一中腰鼓!

    题意:给你一个序列,初始是0,每次一个操作,把一个数^=1 每次求出最长01串的长度 正解:线段树(虽然暴力能过) 对于每个区间,记录三个值 lmax,以l为首的01串长度 rmax,以r为尾的01串 ...

  8. luogu2480 [SDOI2010]古代猪文

    link 题意一开始没TM读懂... 就是给定一个\(G\le10^{10},N\le10^9\),求\(G^{\sum_{d|n}{n\choose d}}\),对999911659取模 由于999 ...

  9. IOS 浏览器上设置overflow: auto 不可滚动

    项目中最近遇到一个bug,在ios上出现的问题:原页面是在某一块地方滚动,但是改版后,滚动区域改为最外层元素,最外层包裹了一层class为main的div .main { position: fixe ...

  10. kuangbin专题十六 KMP&&扩展KMP POJ2752 Seek the Name, Seek the Fame

    The little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the l ...