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. WPARAM和LPARAM的含义

    lParam 和 wParam 是宏定义,一般在消息函数中带这两个类型的参数,通常用来存储窗口消息的参数. LRESULT CALLBACK WindowProc(HWND hwnd, UINT uM ...

  2. 网易CentOS yum源

    wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

  3. spark(2.1) - spark-shell 下文件系统的数据读写

    spark-shell 本地文件系统数据读写 [ file:// ] 读取 :sc.textFile (" ****") 写入:saveAsTextFile ("**** ...

  4. pychram编写代码鼠标变粗处理

    现象:如下图 解决: 键盘 点击 insert 按钮即可解决

  5. go语言实战教程之 后台管理页面统计功能开发(1)

    本节内容我们将学习开发实现后台管理平台页面统计功能开发的功能接口,本章节内容将涉及到多种请求路由的方式. 功能介绍 后台管理平台不仅是功能管理平台,同时还是数据管理平台.从数据管理平台角度来说,在管理 ...

  6. C#中工厂模式的作用

    1.比如,主要用于对扩展性有要求的功能. 以简单工厂为例: 接口Fun有三个实现 class FunA FunB FunC工厂 class Fac {   public static Fun getF ...

  7. Orcale创建函数(function)

    Oraclec创建函数的语法规则 create or replace function  函数名 (参数名1 参数类型,参数名2 参数类型)  return number  is Result num ...

  8. 1、OpenCV Python 图像加载和保存

    __author__ = "WSX" import cv2 as cv # 这里的文件是图片或者视频 def Save_File( image ): cv.imwrite(&quo ...

  9. 小程序获取unionId以及手机号

    1.前端小程序传入后端接口的入参如下: code :临时登录凭证(必传)encryptedData:密文iv:偏移量 2.接收到入参后的java后端接口中的代码如下: @Action(value = ...

  10. gym 101889I Imperial roads 最小生成树+LCA

    题目传送门 题意: 给出一幅无向带权图,q次询问,每次询问都求一棵包含给出的边的最小生成树. 思路: 首先求出最小生成树(kruskal),如果查询的边在最小生成树上,肯定是直接输出最小生成树,如果不 ...