#include
#include
#define MAX_LEN 233
int main ()
{
int i,j,lm,lp,min1,min2,slocation;
char tbottom[MAX_LEN],ttop[MAX_LEN],temp[MAX_LEN];
while( scanf("%s",tbottom) != EOF )
{
scanf("%s",ttop);
lp=strlen(ttop);
lm=strlen(tbottom);
for(i=0,j=0,slocation=0; i3)
{
i=0;
slocation++;
j=slocation;
tbottom[lm+slocation-1]='0';
tbottom[lm+slocation]='\0';
continue;
}
else
{
i++;
j++;
}
}
min1=((slocation+lp)3)
{
i=0;
slocation++;
j=slocation;
ttop[lm+slocation-1]='0';
ttop[lm+slocation]='\0';
continue;
}
else
{
i++;
j++;
}
}
min2=(slocation+lm);
printf("%d\n",(min1>min2?min2:min1));
}
return 0;
}
Acceped:
#include
#include
#define MAX_LEN 233
int main () {
int i,j,lm,lp,min1,min2,slocation;
char tbottom[MAX_LEN],ttop[MAX_LEN],temp[MAX_LEN];
while( scanf("%s%s",tbottom,ttop) != EOF ) {
lp=strlen(ttop);
lm=strlen(tbottom);
if(lp>lm) {
strcpy(temp,ttop);
strcpy(ttop,tbottom);
strcpy(tbottom,temp);
i=lp;
lp=lm;
lm=i;
}
for(i=0,j=0,slocation=0; i3) {
i=0;
slocation++;
j=slocation;
tbottom[lm+slocation-1]='0';
continue;
} else {
i++;
j++;
}
}
min1=((slocation+lp)3) {
i=0;
slocation++;
j=slocation;
ttop[lm+slocation-1]='0';
ttop[lm+slocation]='\0';
continue;
} else {
i++;
j++;
}
}
min2=(slocation+lm);
printf("%d\n",(min1>min2?min2:min1));
}
return 0;
}