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<iostream>
using namespace std;
char s1[], s2[];
int main(){
int hashTB[] = {,};
gets(s1);
gets(s2);
for(int i = ; s2[i] != '\0'; i++)
hashTB[s2[i]] = ;
for(int i = ; s1[i] != '\0'; i++)
if(hashTB[s1[i]] == )
printf("%c", s1[i]);
cin >> s1;
return ;
}

A1050. String Subtraction的更多相关文章

  1. A1050 String Subtraction (20 分)

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

  2. PAT甲级——A1050 String Subtraction

    Given two strings S​1​​ and S​2​​, S=S​1​​−S​2​​ is defined to be the remaining string after taking ...

  3. PAT_A1050#String Subtraction

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

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

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

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

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

  7. pat1050. String Subtraction (20)

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

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

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

随机推荐

  1. HAOI2016 找相同字符 后缀自动机

    两个串,考虑一建一跑.枚举模式串的位置\(i\),考虑每次统计以\(i\)结尾的所有符合要求的串.在后缀自动机上走时记录当前匹配长度\(curlen\),则当前节点的贡献是\((curlen-len[ ...

  2. 结对项目gobang

    题目介绍:实现五子棋的基本规则,分黑棋和白棋.连成5个的胜利,完成了五子棋的单人游戏. 代码地址:https://github.com/liuxianchen/gobang 结对人:刘仙臣  康佳 结 ...

  3. BETA 版冲刺前准备

    任务博客 组长博客 总的来讲Alpha阶段我们计划中的工作是如期完成的.不过由于这样那样的原因,前后端各个任务完成度不算非常高,距离完成一个真正好用.完美的软件还有所差距. 过去存在的问题 测试工作未 ...

  4. CentOS7 安装 Jenkins

    1. 安装java环境, 自己的虚拟机里面前期已经安装好了 检查一下: [root@centos74 ~]# java -versionopenjdk version "1.8.0_131& ...

  5. GlusterFS卷的优化

    GlusterFS可以通过配置选项来优化卷 配置选项 用途 默认值 合法值 network.ping-timeout    客户端等待检查服务器是否响应的持续时间,节点挂了数据不能写入 42 0-42 ...

  6. CAS登陆过程UML中文版

    如果大家图片显示看不请,可以点击图片右键:在新窗口中打开图片,进行查看 名词解释 CASTGC:向cookie中添加该值的目的是当下次访问 认证中心 时,浏览器将Cookie中的TGC携带到服务器,服 ...

  7. js對象

    js聲明一個數據,即使沒有賦值,也是創建了一個對象: js的所有數據都是對象,對象裡面有屬性也有方法,屬性方法是對象中的成員: 訪問對象的屬性:objectname.屬性名 訪問對象的方法:objec ...

  8. python---random模块详解

    在python中用于生成随机数的模块是random,在使用前需要import, 下面看下它的用法. random.random random.random()用于生成一个0到1的随机符点数: 0 &l ...

  9. POJ2492-A Bug's Life-并查集扩展应用

    维护一个relation数组,保留着此元素和根元素之间的性别关系.之后就可以判断gay了. #include <cstdio> #include <algorithm> #in ...

  10. BZOJ5338 [TJOI2018] Xor 【可持久化Trie树】【dfs序】

    题目分析: 很无聊的一道题目.首先区间内单点对应异或值的询问容易想到trie树.由于题目在树上进行,case1将路径分成两段,然后dfs的时候顺便可持久化trie树做询问.case2维护dfs序,对d ...