解题说明:水题,如果两个字符串不完全一样的话,最长不同子串肯定是其中最长的字符串。
#include<stdio.h>
#include<string.h>
int main()
{
char a[100001], b[100001];
int la,lb;
scanf("%s %s", &a, &b);
la = strlen(a);
lb = strlen(b);
if(la!=lb)
{
printf("%d\n", la>lb?la:lb);
}
else if(strcmp(a,b))
{
printf("%d\n", la);
}
else
{
printf("-1\n");
}
return 0;
}