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 ...
随机推荐
- Mysql之binlog日志说明及利用binlog日志恢复数据操作记录
众所周知,binlog日志对于mysql数据库来说是十分重要的.在数据丢失的紧急情况下,我们往往会想到用binlog日志功能进行数据恢复(定时全备份+binlog日志恢复增量数据部分),化险为夷! 一 ...
- BZOJ3782 上学路线
设障碍个数为,\(obs\)则一般的容斥复杂度为\(O(2^{obs})\).但因为这个题是网格图,我们可以用DP解.设\(f[i]\)表示不经过任何障碍到达第\(i\)个障碍的方案数,转移时枚举可以 ...
- 第六周-总结&结对编程
1.结对编程 结对编程的Partner依旧是郑蕊师姐(博客:http://www.cnblogs.com/zhengrui0452/) 我们一起改进的是郑蕊师姐做的“四则运算” 郑蕊师姐之前完成四则运 ...
- 实现基于SSH的门票管理系统开发的质量属性
我要做的是一个基于SSH的门票售卖系统,在系统中常见的质量属性有:可用性.可修改性.性能.安全性.易用性. 可用性方面: 可用性是指系统正常运行时间的比例,是通过两次故障之间的时间长度或在系统崩溃情况 ...
- VS2015 导航栏 查看每个cpp文件中类以及类成员函数的框框
这个可以查看每个cpp文件中类以及类成员函数的框框叫导航栏! 怎么打开导航栏可以再百度.
- ABP编译必须添加对程序集“netstandard, Version=2.0.0.0错误
当前使用ABP版本为:4.6.0 升级vs2017到15.4版本,升级framework到4.7版本 如果Core版本请升级到net core 2
- Eclipse:An internal error occurred during: "Building workspace". GC overhead limit exceeded
http://blog.csdn.net/shaozhang872196/article/details/18552273 http://www.cnblogs.com/sonofelice/p/52 ...
- remove()与empty()的区别
1.empty() - 从被选元素中删除子元素: 2.remove() - 删除被选元素(及其子元素): 3.remove() 方法也可接受一个参数,允许您对被删元素进行过滤.
- NAT模式下VMware中CentOS7无法连接外网的解决方法
故障现象 ----------------------------------------------------------------------------------------------- ...
- jQuery 簡介
jQuery:是一個js庫,可以極大地簡化編程,“寫得少做得多”. jquery的作用: 挑選元素.操作屬性.事件函數.動畫和效果.ajax: jQuery庫:google和microsoft都支持, ...