void add(char a[],char b[],char back[])
{
int i,j,k,up,x,y,z,l;
char *c;
if (strlen(a)>strlen(b)) l=strlen(a)+2; else l=strlen(b)+2;
c=(char *) malloc(l*sizeof(char));
i=strlen(a)-1;
j=strlen(b)-1;
k=0;up=0;
while(i>=0||j>=0)
{
if(i<0) x='0'; else x=a[i];
if(j<0) y='0'; else y=b[j];
z=x-'0'+y-'0';
if(up) z+=1;
if(z>9) {up=1;z%=10;} else up=0;
c[k++]=z+'0';
i--;j--;
}
if(up) c[k++]='1';
i=0;
c[k]='\0';
for(k-=1;k>=0;k--)
back[i++]=c[k];
back[i]='\0';
}
void sub(char s1[],char s2[],char t[])
{
int i,l2,l1,k;
l2=strlen(s2);l1=strlen(s1);
t[l1]='\0';l1--;
for (i=l2-1;i>=0;i--,l1--)
{
if (s1[l1]-s2[i]>=0)
t[l1]=s1[l1]-s2[i]+'0';
else
{
t[l1]=10+s1[l1]-s2[i]+'0';
s1[l1-1]=s1[l1-1]-1;
}
}
k=l1;
while(s1[k]<0) {s1[k]+=10;s1[k-1]-=1;k--;}
while(l1>=0) {t[l1]=s1[l1];l1--;}
loop:
if (t[0]=='0')
{
l1=strlen(s1);
for (i=0;i<l1-1;i++) t[i]=t[i+1];
t[l1-1]='\0';
goto loop;
}
if (strlen(t)==0) {t[0]='0';t[1]='\0';}
}