Untitled
unknown
plain_text
2 years ago
652 B
8
Indexable
#include <iostream>
#include <string>
using namespace std;
int main()
{
string a,b;
while(getline(cin,a)&&getline(cin,b)){
int aa[26]={0},bb[26]={0};
for(int i=0;i<a.length();i++){
int tmp;
tmp=a[i]-'a';
aa[tmp]=1;
}
for(int i=0;i<b.length();i++){
int tmp2;
tmp2=b[i]-'a';
bb[tmp2]=1;
}
for(int j=0;j<=26;j++){
if(aa[j]==1&&bb[j]==1){
cout<< char (j+'a');
}
}
cout<<endl;
}
return 0;
}
Editor is loading...