#include <iostream> #include <cstdio> #include <cstring> using namespace std; int main(){ char a[999],b[999],c[999]; while(cin>>a>>b){ int k=0; for(int i=0;i<strlen(a);i++){ for(int j=0;j<strlen(b);j++){ if(a[i]==b[j]){ c[k++]=a[i]; b[j]='*'; break; } } } sort(c,c+k); for(int i=0;i<k;i++){ cout<<c[i]; } cout<<endl; } return 0; } /* Main.cc: In function 'int main()': Main.cc:9:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i=0;i<strlen(a);i++){ ^ Main.cc:10:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int j=0;j<strlen(b);j++){ ^ Main.cc:18:19: error: 'sort' was not declared in this scope sort(c,c+k); ^ */ |
Double click to view unformatted code.