#include<stdio.h> #include<math.h> #include<string.h> int main(){ char a[1000]; char b[1000; char c[1000]; int i,j,k,n,m; char temp; while(gets(a)){ gets(b); k=0; n=strlen(a); m=strlen(b); for(i=0;i<n;i++){ for(j=0;j<m;j++){ if(a[i]==b[j]){ c[k]=b[j]; b[j]='1'; k++; break; } } } c[k]='\0'; for(i=0;i<strlen(c);i++){ for(j=i;j<strlen(c);j++){ if(c[i]>c[j]){ temp=c[i]; c[i]=c[j]; c[j]=temp; } } } puts(c); printf("\n"); } return 0; } /* Main.c: In function 'main': Main.c:6:13: error: expected ']' before ';' token char b[1000; ^ Main.c:39:1: error: expected declaration or statement at end of input } ^ Main.c:5:7: warning: unused variable 'a' [-Wunused-variable] char a[1000]; ^ */ |
Double click to view unformatted code.