-
Notifications
You must be signed in to change notification settings - Fork 14
/
10252.cpp
54 lines (50 loc) · 1.07 KB
/
10252.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
#define FOI(i, A, B) for(i=A; i<=B; i++)
#define FOD(i, A, B) for(i=A; i>=B; i--)
string alpha = "abcdefghijklmnopqrstuvwxyz";
int main(){
//freopen("testI.txt", "r", stdin);
//freopen("testO.txt", "w", stdout);
string A, B;
while (getline(cin, A) && getline(cin, B)) {
int arr[26], brr[26] ;
memset(arr, 0, sizeof arr);
memset(brr, 0, sizeof brr);
int aL = A.length() - 1;
int bL = B.length() - 1;
int i, j;
FOI(i, 0, aL) ++arr[A[i] - 'a'];
FOI(i, 0, bL) ++brr[B[i] - 'a'];
FOI(i, 0, 25){
int M = min(arr[i], brr[i]) - 1;
FOI(j, 0, M) cout << alpha[i];
}
cout << endl;
}
return 0;
}