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. java多线程学习笔记(三)

    java多线程下的对象及变量的并发访问 上一节讲到,并发访问的时候,因为是多线程,变量如果不加锁的话,会出现“脏读”的现象,这个时候需要“临界区”的出现去解决多线程的安全的并发访问.(这个“脏读”的现 ...

  2. linux替换rm命令,防止误删

    1. 在/home/username/ 目录下新建一个目录,命名为:.trash 2.. 在/home/username/tools/目录下,新建一个shell文件,命名为: remove.sh #! ...

  3. 深入理解javascript原型和闭包(1)——一切都是对象 (转载)

    深入理解javascript原型和闭包(1)——一切都是对象  http://www.cnblogs.com/wangfupeng1988/p/3977987.html “一切都是对象”这句话的重点在 ...

  4. Android组件内核之组件间通信方案(四)上篇

    阿里P7Android高级架构进阶视频免费学习请点击:https://space.bilibili.com/474380680本篇文章将先从以下三个内容来介绍通信方案: [Activity与Fragm ...

  5. Javascript连续赋值

    Javascript对象属于引用类型,将对象赋值给变量相当于将对象地址赋值给变量 let a = {n: 1}; let b = a; a.x = a = {n: 2}; //运算符的优先级 cons ...

  6. 用IDEA打可运行的jar包

    今天,需要将一个定时项目打成jar包,直接放在服务器上运行,看了一下要求是将依赖包几种放到lib文件夹下,以前都是用maven来打包的.这一次想利用idea直接打包. 但是打完包后运行发现一直缺失ma ...

  7. js数组去重练习

  8. IIS ASP.NET MVC 上传文件到NAS目录

    项目要求,网站用户上传的文件,存储到服务器挂接的NAS磁盘里,死活也写不进去,一直提示 System.IO.IOException: 指定的服务器无法运行请求的操作 阿里的客服也问过了, 一群只知道发 ...

  9. java序列化对象为什么要定义serialversionUID值?

    SerialVersionUid,简言之,其目的是序列化对象版本控制,有关各版本反序列化时是否兼容.如果在新版本中这个值修改了,新版本就不兼容旧版本,反序列化时会抛出InvalidClassExcep ...

  10. mongoose 常用数据库操作 插入

    项目 db.js var mongoose = require('mongoose'); mongoose.connect('mongodb://127.0.0.1:27017/whhhh', { u ...