1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
#include<stdio.h>
#include<string.h>
#define N 100010
char s1[N], s2[N];
int main()
{
int len;
while(~scanf("%s%s", s1, s2))
{
int k=2, t=0;
len=strlen(s1);
for(int i=0;i<len;i++)
{
if(s1[i]!=s2[i])
{
t++;
}
}
if(t%2!=0)
{
printf("impossible\n");
continue;
}
for(int i=0;i<len;i++)
{
if(s1[i]==s2[i])
printf("0");
else
{
if(k%2)
printf("%c", s1[i]);
else
printf("%c", s2[i]);
k++;
}
}
printf("\n");
}
return 0;
}
来源:CSDN
作者:AC--我进步的足迹
链接:https://blog.csdn.net/zhACMer/article/details/47393959