#include<stdio.h> #include<string.h> int main(){ int i,j; char a[100]; char b[1000]; int c[26]; while(gets(a)!=NULL&&gets(b)!=NULL){ c[26]={0}; int len1=strlen(a),len2=strlen(b); for(i=0;i<len1;i++){ for(j=0;j<len2;j++) if(a[i]==b[j]){ c[a[i]-'a']++; b[j]=' '; break; } } for(i=0;i<26;i++) if(c[i]>0) for(j=0;j<c[i];j++) printf("%c",i+'a'); printf("\n"); } } /* Main.c: In function 'main': Main.c:8:2: warning: 'gets' is deprecated [-Wdeprecated-declarations] while(gets(a)!=NULL&&gets(b)!=NULL){ ^~~~~ In file included from Main.c:1: /usr/include/stdio.h:583:14: note: declared here extern char *gets (char *__s) __wur __attribute_deprecated__; ^~~~ Main.c:8:2: warning: 'gets' is deprecated [-Wdeprecated-declarations] while(gets(a)!=NULL&&gets(b)!=NULL){ ^~~~~ In file included from Main.c:1: /usr/include/stdio.h:583:14: note: declared here extern char *gets (char *__s) __wur __attribute_deprecated__; ^~~~ Main.c:9:10: error: expected expression before '{' token c[26]={0}; ^ */ |
Double click to view unformatted code.