你出得声伸手,我就练练手,看能否达意。
#include <stdio.h>
#include <ctype.h>
main()
{
char a[51], b[51], c[256]={0}, *p;
gets(a);
gets(b);
for (p=a; *p; p++)
if (c[toupper(*p)] == 0)
c[toupper(*p)] = 1;
else
return; //重复
for (p=b; *p; p++)
if (c[toupper(*p)] == 1)
c[toupper(*p)] = 0;
for (p=a; *p; p++)
if (c[toupper(*p)] == 1)
{
c[toupper(*p)] = 0;
c[*p] = 1;
}
int i;
for (i=0; i<256; i++)
if (c[i] == 1)
printf("%c", i);
}