A1050. String Subtraction
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的更多相关文章
- A1050 String Subtraction (20 分)
一.技术总结 这个是使用了一个bool类型的数组来判断该字符是否应该被输出. 然后就是如果在str2中出现那么就判断为false,被消除不被输出. 遍历str1如果字符位true则输出该字符. 还有需 ...
- PAT甲级——A1050 String Subtraction
Given two strings S1 and S2, S=S1−S2 is defined to be the remaining string after taking ...
- PAT_A1050#String Subtraction
Source: PAT A1050 String Subtraction (20 分) Description: Given two strings S1 and S2, S=S1− ...
- 1050 String Subtraction (20 分)
1050 String Subtraction (20 分) Given two strings S1 and S2, S=S1−S2 is defined to be the ...
- PAT 解题报告 1050. String Subtraction (20)
1050. String Subtraction (20) Given two strings S1 and S2, S = S1 - S2 is defined to be the remainin ...
- PAT 1050 String Subtraction
1050 String Subtraction (20 分) Given two strings S1 and S2, S=S1−S2 is defined to be t ...
- pat1050. String Subtraction (20)
1050. String Subtraction (20) 时间限制 10 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Giv ...
- pat 1050 String Subtraction(20 分)
1050 String Subtraction(20 分) Given two strings S1 and S2, S=S1−S2 is defined to be the ...
- PAT 甲级 1050 String Subtraction (20 分) (简单送分,getline(cin,s)的使用)
1050 String Subtraction (20 分) Given two strings S1 and S2, S=S1−S2 is defined to be t ...
随机推荐
- Mvc_ActionResult返回值
//ViewResult 表示HTML的页面内容 //EmptyResult 表示空白的页面内容 //RedirectResult 表示定位到另外一个URL //JsonResult 表示可以运用到A ...
- TRIO-basic指令--MOVEMODIFY
Syntax: MOVEMODIFY(position) Parameters: position: Absolute position for the current move to complet ...
- 使用阿里云cli管理安全组
相比于python SDK方式,阿里云基于GO SDK开发了一整套CLI工具,可以通过调用RPC API来管理云资源,对编程能力不够的人来说是个福音. 而且,阿里云CLI的文档比SDK的文档更加全面, ...
- Jvm 10 升级笔记
移除了 JPEGCodec https://www.cnblogs.com/liaolongjun/p/6878359.html
- 基于Python的ModbusTCP客户端实现
Modbus协议是由Modicon公司(现在的施耐德电气Schneider Electric)推出,主要建立在物理串口.以太网TCP/IP层之上,目前已经成为工业领域通信协议的业界标准,广泛应用在工业 ...
- 初学习Qt的一些感悟
最近用Qt写了个人项目,有如下心得(可能有不准确): Qt尽管没有扩展C++语法,但是有额外编译链,每个Q_OBJECT类编译的时候会用moc工具生成另一个meta C++类,之后就是标准C++编译流 ...
- 【软件工程Ⅱ】作业二 |分布式版本控制系统Git的安装与使用
本次作业的要去来自于:https://edu.cnblogs.com/campus/gzcc/GZCC-16SE2/homework/2097 远程库地址:https://github.com/Mol ...
- Machine Learning Based Proactive Flow Entry Deletion for OpenFlow
来源:IEEE 2018 作者:Hemin Yang and George F.Riley 摘要: 流表容量有限,因此高效管理流表至关重要.本文重点讨论了OpenFlow中定义的一种流表管理机制,即能 ...
- HTML 页面的 批量删除的按钮
function delAll(){ var sid=""; $("[name='ids']:checked").each(function(){ sid+=$ ...
- Angular 序列化和反序列化和遍历
<!DOCTYPE html><html ng-app="myApp"><head lang="en"> <meta ...