#include <stdio.h> #include <string.h> int main(){ char a[1000],b[1000],c[1000]; while(~scanf("%s %s",a,b)){ int i,j,k=0,temp; for(i=0;i<strlen(a);i++) for(j=0;j<strlen(b);j++){ if(a[i]==b[j]){ c[k++]=a[i]; b[i]='*'; break; } } for(i=0;i<k;i++){ for(j=i+1;j<k;j++) if(c[i]>c[j]){ temp=c[i]; c[i]=c[j]; c[j]=temp; } printf("%c",c[i]); } printf("\n"); } /* Main.c: In function 'main': Main.c:26:3: error: expected declaration or statement at end of input } ^ */ |
Double click to view unformatted code.