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.

#include <iostream>
using namespace std; int main(){
string s1,s2,res="";
getline(cin,s1);
getline(cin,s2);
for(int i=;i<s1.length();i++){
if(s2.find(s1[i])==s2.npos) res+=s1[i];
}
cout<<res;
system("pause");
return ;
}
 

PAT Advanced 1050 String Subtraction (20 分)的更多相关文章

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

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

  3. PAT练习--1050 String Subtraction (20 分)

    题⽬⼤意:给出两个字符串,在第⼀个字符串中删除第⼆个字符串中出现过的所有字符并输出. 这道题的思路:将哈希表里关于字符串s2的所有字符都置为true,再对s1的每个字符进行判断,若Hash[s1[i] ...

  4. 【PAT甲级】1050 String Subtraction (20 分)

    题意: 输入两个串,长度小于10000,输出第一个串去掉第二个串含有的字符的余串. trick: ascii码为0的是NULL,减去'0','a','A',均会导致可能减成负数. AAAAAccept ...

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

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

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

  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. PAT (Advanced Level) 1050. String Subtraction (20)

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

  9. PAT Advanced 1042 Shuffling Machine (20 分)(知识点:利用sstream进行转换int和string)

    Shuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling techn ...

随机推荐

  1. kotlin之数组

    一.使用arrayOf函数定义可以存储任意值的数组 var arr1 = arrayOf(1,2,3,'a') println(arr1[3]) 二.使用arrayOfNulls函数定义数组 var ...

  2. 找回从pycharm中删除的文件及文件夹

  3. 十六:jinja2中的if和for

    jinja2中的逻辑语句和python中的基本一致,执行逻辑的时候用{% 逻辑关键字 %}开始,{% end逻辑关键字 %}结束 if语句(判断关键字也是一样的,and.or.not···): for ...

  4. 原生dapper中新增用户后根据用户id,在用户角色表中添加关联数据,事务处理

    var result = 0; var userId = 0; using (var db = _Sql.Connection) using (var tran =db.BeginTransactio ...

  5. Golang基础(8):go interface接口

    一:接口概要 接口是一种重要的类型,他是一组确定的方法集合. 一个接口变量可以存储任何实现了接口方法的具体值.一个重要的例子就是io.Reader和io.Writer type Reader inte ...

  6. P2085 最小函数值

    题目链接hhh:https://www.luogu.org/problemnew/show/P2085好嘛,运气真好,刚A掉序列合并,正好碰到这题,可以说是序列合并的升级版了 那么简单说一下思路,首先 ...

  7. Ubuntu16.04安装NVIDIA驱动、实现GPU加速

    NVIDIA驱动前前后后装了好几遍,下面把个人的经验分享下,大家仅供参考. 老规矩,先引用师兄的(最详细)https://blog.csdn.net/sinat_23853639/article/de ...

  8. Pytorch实现Top1准确率和Top5准确率

    之前一直不清楚Top1和Top5是什么,其实搞清楚了很简单,就是两种衡量指标,其中,Top1就是普通的Accuracy,Top5比Top1衡量标准更“严格”, 具体来讲,比如一共需要分10类,每次分类 ...

  9. Yarn-本地获取任务日志

    Yarn-本地获取任务日志 yarn logs -applicationId application_1517538889175_2550 > logs.txt

  10. idea工具

    1. 使用IntelliJ IDEA 配置JDK(入门)   https://blog.csdn.net/nobb111/article/details/77116259 2. idea 调试快捷键  ...