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