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>
#include <string>
using namespace std;
int main()
{
int ascll[] = { };
string str = "", S1, S2;
getline(cin, S1);
getline(cin, S2);//注意S2也可能有空格
cin >> S2;
for (int i = ; i < S2.length(); ++i)
ascll[S2[i]] = -;
for (int i = ; i < S1.length(); ++i)
if (ascll[S1[i]] == )
cout << S1[i];
return ;
}

PAT甲级——A1050 String Subtraction的更多相关文章

  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甲级——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 ...

  3. PAT 甲级 1050 String Subtraction

    https://pintia.cn/problem-sets/994805342720868352/problems/994805429018673152 Given two strings S~1~ ...

  4. A1050. String Subtraction

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

  5. A1050 String Subtraction (20 分)

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

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

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

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

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

  9. PAT_A1050#String Subtraction

    Source: PAT A1050 String Subtraction (20 分) Description: Given two strings S​1​​ and S​2​​, S=S​1​​− ...

随机推荐

  1. 使用gulp搭建less编译环境

    什么是less? 一种 动态 样式 语言. LESS 将 CSS 赋予了动态语言的特性,如 变量, 继承, 运算, 函数. LESS 既可以在 客户端 上运行 (支持IE 6+, Webkit, Fi ...

  2. SSM三大框架的运行流程、原理、核心技术详解

    一.Spring部分1.Spring的运行流程第一步:加载配置文件ApplicationContext ac = new ClassPathXmlApplicationContext("be ...

  3. 2、java变量+零碎知识点

    1>展示console:window--show view--console2>创建工程 右键--new---java project 文件夹 jre src 所有的java类都在src中 ...

  4. vue-resourse简单使用方法

    一.安装引用 安装: npm install vue-resource --save-dev 引用: /*引入Vue框架*/ import Vue from 'vue' /*引入资源请求插件*/ im ...

  5. Ubuntu 12.04 Eclipse设置 Javadoc背景色

    在Ambiance主题下,eclipse弹出的tip是黑色背景的,这样压根就看不清java doc. 当然可以在外观改变系统主题为其他主题,相应的gtk-2.0/gtkrc要重新设置,比如Ubuntu ...

  6. Webstorm在MAC下的安装方法

    一 .注册时,在打开的License Activation窗口中选择“License server”,在输入框输入下面的网址: http://idea.codebeta.cn (新,感谢Rachels ...

  7. Composer的简介说明与安装

    https://mp.weixin.qq.com/s/aSZRhoa2-JjKOTRVhPdxdQ Composer 是 PHP 的一个依赖管理工具.它允许你申明项目所依赖的代码库,它会在你的项目中为 ...

  8. 101 删除排序数组中的重复数字 II

    原题网址:http://www.lintcode.com/zh-cn/problem/remove-duplicates-from-sorted-array-ii/# 跟进“删除重复数字”: 如果可以 ...

  9. Hack Tools

    Tools 2011-03-17 13:54:36|  分类: Security|举报|字号 订阅     Packet Shaper:Nemesis: a command line packet s ...

  10. docker中使用源码方式搭建SRS流媒体服务

    一.背景 搭建流媒体服务的方式一般会采用nginx+rtmp和srs服务两种,前者是nginx加上插件所用,而后者是专门为了为了流媒体而生,在这一节中我们将从头搭建srs流媒体服务 二. 运行环境 为 ...