#include<stdio.h> #include<string.h> int main() { char a[1000],b[1000]; int first[1000]={0}; while(gets(a)) { gets(b); memset(first,0,sizeof(first)); int i,j; for(i=0;a[i]!='\0';i++) { for(j=0;b[j]!='\0';j++) { if(!first[j]&&a[i]==b[j]) { putchar(b[j]); first[j]=1; break; } } } printf("\n"); } return 0; } |
Double click to view unformatted code.