1050 String Subtraction
Statement
Metadata
- 作者: CHEN, Yue
- 单位: 浙江大学
- 代码长度限制: 16 KB
- 时间限制: 100 ms
- 内存限制: 64 MB
Given two strings
Input Specification
Each input file contains one test case. Each case consists of two lines which gives
Output Specification
For each test case, print
Sample Input
Sample Output
Solution
#include <bits/stdc++.h>
using namespace std;
int main() {
string s1, s2;
getline(cin, s1);
getline(cin, s2);
map<char, int> p;
int len1 = s1.size(), len2 = s2.size(), i;
for (i = 0; i < len2; i++) p[s2[i]] = 1;
for (i = 0; i < len1; i++) {
if (!p[s1[i]])
cout << s1[i];
}
cout << endl;
}
Last update: May 4, 2022