string subtraction
来源:互联网 发布:关闭1099端口 编辑:程序博客网 时间:2024/06/04 18:40
1050. String Subtraction (20)
时间限制
100 ms
内存限制
65536 kB
代码长度限制
16000 B
判题程序
Standard
作者
CHEN, Yue
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.aeiouSample Output:
Thy r stdnts.
#include<iostream>#include<string>#include<vector>#include<map>using namespace std;int main(){ map<char,bool> m;vector<char> v;string s1,s2;getline(cin,s1);getline(cin,s2);for(int i=0;i<s1.size();i++){m[s1[i]]=true;}for(int i=0;i<s2.size();i++){m[s2[i]]=false;}for(int i=0;i<s1.size();i++){if(m[s1[i]]){v.push_back(s1[i]);}}for(int i=0;i<v.size();i++){cout<<v[i];}return 0;}
阅读全文
0 0
- String Subtraction
- string subtraction
- 1050. String Subtraction (20)
- 1050. String Subtraction
- PAT_1050: String Subtraction
- 1050. String Subtraction (20)
- 1050. String Subtraction (20)
- 1050. String Subtraction (20)
- PAT 1050. String Subtraction
- [哈希]PAT1050 String Subtraction
- 1050. String Subtraction
- 1050. String Subtraction (20)
- 1050. String Subtraction
- 1050. String Subtraction (20)
- PAT 1050 String Subtraction
- 1050. String Subtraction (20)
- 1050.String Subtraction
- 1050. String Subtraction (20)
- POJ2299 树状数组求逆序对
- 快速搭建php rbac后台
- 欢迎使用CSDN-markdown编辑器
- x264官方学习文档(3)——英文资料,极具参考价值
- UIWebView 的坑点
- string subtraction
- 感兴趣的博客地址临时记录
- Session简单介绍
- 再见Win7----记录Win7系统的安装
- 文章标题
- 各位相加
- SpringBoot 在CentOS7部署
- OpenGLES FBO-BlitFramebuffer MSAA 抗锯齿的实现
- Sublime 添加vue模板