Source:

PAT A1050 String Subtraction (20 分)

Description:

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

Keys:

Code:

 /*
Data: 2019-07-21 19:47:24
Problem: PAT_A1050#String Subtraction
AC: 08:34 题目大意:
给定字符串S和T,把T中的字符从S中删去
*/ #include<cstdio>
#include<string>
#include<iostream>
using namespace std;
char mp[]={}; int main()
{
#ifdef ONLINE_JUDGE
#else
freopen("Test.txt", "r", stdin);
#endif string s,t;
getline(cin,s);
getline(cin,t);
for(int i=; i<t.size(); i++)
mp[t[i]]=;
for(int i=; i<s.size(); i++)
if(mp[s[i]]==)
printf("%c", s[i]); return ;
}

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

PAT_A1050#String Subtraction的更多相关文章

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

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

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

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

  4. pat1050. String Subtraction (20)

    1050. String Subtraction (20) 时间限制 10 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Giv ...

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

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

  7. PAT甲级——1050 String Subtraction

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

  8. 1050. String Subtraction (20)

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

  9. String Subtraction

    Given two strings S1 and S2, S = S1 - S2 is defined to be the remaining string after taking all the ...

随机推荐

  1. centos svn 安装

    #检查是否安装了低版本的SVN [root@zck /]# rpm -qa subversion #卸载旧版本SVN [root@zck modules]# yum remove subversion ...

  2. Webx.0-Web4.0:Web4.0

    ylbtech-Webx.0-Web4.0:Web4.0 Web系统是人类迄今最伟大的发明之一,也是计算机影响人类最深远的表现. 1.返回顶部 1. Web系统是人类迄今最伟大的发明之一,也是计算机影 ...

  3. libVEX学习

    VEX IR是一种更加接近于compiler使用的中间语言/中间表示,它是不依赖于特定体系架构的. 1. Code Blocks code blocks是VEX处理代码的一个单元,使用IRSB结构体表 ...

  4. upc组队赛6 Greeting Card【打表】

    Greeting Card 题目描述 Quido plans to send a New Year greeting to his friend Hugo. He has recently acqui ...

  5. Node.js、vue.js的使用

    Vue.js的使用 1.下载Node.js 2.打开cmd 3.执行命令 npm i 4.输入命令 npm run serve 5.浏览器打开  http://localhost:8080

  6. fedora 25重新安装引导

    引导区被其他系统给覆盖了,重新安装引导 grub2-install /dev/sdb GRUB_SAVEDEFAULT=true BIOS grub2-mkconfig -o /boot/grub2/ ...

  7. 用java api 实现查询 Hive 数据

    版本:cdh5.4.7, hive1.1.0 pom文件 <dependency> <groupId>org.apache.hive</groupId> <a ...

  8. 还在用 KPI 管研发团队?用 OKR 倍儿爽!

    近几年,经常能听到不少技术管理者在倡导:用 OKR 来管理及打造一个高执行力的研发团队. 据我了解,OKR 最成功的落地公司是在 Google --一家有着非常浓厚工程师文化的公司,后来陆续在 Fac ...

  9. CF1223D

    CF1223D 不需要动的一定值域连续 #include<iostream> #include<cstring> #include<cstdio> #include ...

  10. android中的Serveice组件

    创建 配置 Service: 1.定义一个继承了Service类的子类 2.在 AndroidManifest.xml清单文件中对开发的Service进行配置 Service和Activity很相似, ...