#include<iostream> #include<cstdio> using namespace std; int main() { string a; string b; while(cin >> a) { cin >> b; int n[26]={0}; for(int i = 0; i < a.length(); i++) { int pos = -1; pos = b.find(a[i]); if(pos != -1) { n[a[i]-'a']++; b[pos] = '0'; } } for(int i = 0; i < 26; i++) while(n[i]--) cout << (char)(i + 'a'); cout << endl; } return 0; } |
Double click to view unformatted code.