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 ...
随机推荐
- Centos下PPTP环境部署记录
PPTP(点到点隧道协议)是一种用于让远程用户拨号连接到本地的ISP,通过因特网安全远程访问公司资源的新型技术.它能将PPP(点到点协议)帧封装成IP数据包,以便能够在基于IP的互联网上进行传输.PP ...
- nginx域名访问的白名单配置梳理
在日常运维工作中,会碰到这样的需求:设置网站访问只对某些ip开放,其他ip的客户端都不能访问.可以通过下面四种方法来达到这种效果:1)针对nginx域名配置所启用的端口(比如80端口)在iptable ...
- 测试网站页面网速的一个简单Python脚本
无聊之余,下面分享一个Python小脚本:测试网站页面访问速度 [root@huanqiu ~]# vim pywww.py #!/usr/bin/python # coding: UTF-8 imp ...
- mysql操作命令梳理(4)-grant授权和revoke回收权限
在mysql维护工作中,做好权限管理是一个很重要的环节.下面对mysql权限操作进行梳理: mysql的权限命令是grant,权限撤销的命令时revoke:grant授权格式:grant 权限列表 o ...
- Redis+TwemProxy(nutcracker)集群方案部署记录
Twemproxy 又称nutcracker ,是一个memcache.Redis协议的轻量级代理,一个用于sharding 的中间件.有了Twemproxy,客户端不直接访问Redis服务器,而是通 ...
- Redis常用操作-------Key(键)
1.DEL key [key ...] 删除给定的一个或多个 key . 不存在的 key 会被忽略. 可用版本: >= 1.0.0 时间复杂度: O(N), N 为被删除的 key 的数量. ...
- 撰写POPUSH需求文档
不当家不知柴米贵,撰写了正规的软件需求文档才知道软件工程的复杂性 感谢@洪宇@王需@江林楠下午的加班加点,五个人正闷在406B奋斗中,加油!
- DrangonBorns
团队介绍 团队名称:DrangonBorns(龙裔) 团队博客:http://www.cnblogs.com/DragonBorns/ 团队队长:蒲建国 队长博客链接:htt ...
- iOS推送证书生成pem文件(详细步骤)
1.pem文件概述 pem文件是服务器向苹果服务器做推送时候需要的文件,主要是给php向苹果服务器验证时使用,下面介绍一下pem文件的生成. 2.生成pem文件步骤 1.打开钥匙串,选择需要生成的推送 ...
- js获取属性
js获取属性的方法: document.getElementById(); document.getElementsByTagname(); document.getElementsByClassna ...