#include <stdio.h>
#include <string.h>
void add(char a[],char b[],char c[])
{
char bas[]={'A','B','C','D','E','F'};
int flag=0;
int tmp,tmp2;
int lena=strlen(a)-1;
int lenb=strlen(b)-1;
int lenc=31;
c[lenc]='\0';
lenc--;
if(lena<lenb) tmp2=lenb;else tmp2=lena;
int i=0;
while(1)
{ //强制转换为大写16进制
if(a[i]!='\0')
{
if(a[i]=='a') a[i]='A';
if(a[i]=='b') a[i]='B';
if(a[i]=='c') a[i]='C';
if(a[i]=='d') a[i]='D';
if(a[i]=='e') a[i]='E';
if(a[i]=='f') a[i]='F';
}
if(b[i]!='\0')
{
if(b[i]=='a') b[i]='A';
if(b[i]=='b') b[i]='B';
if(b[i]=='c') b[i]='C';
if(b[i]=='d') b[i]='D';
if(b[i]=='e') b[i]='E';
if(b[i]=='f') b[i]='F';
}
i++;
if(a[i]=='\0' && b[i]=='\0') break;
}
while(tmp2>=0)
{
if(lena>=0 && lenb>=0)
{
if(a[lena]>'9') tmp =a[lena]-0x37;else tmp=a[lena]-0x30;
if(b[lenb]>'9') tmp+=b[lenb]-0x37;else tmp+=b[lenb]-0x30;
tmp+=flag;
}
if(lena>=0 && lenb<0)
{
if(a[lena]>'9') tmp=a[lena]-0x37;else tmp=a[lena]-0x30;
tmp+=flag;
}
if(lena<0 && lenb>=0)
{
if(b[lena]>'9') tmp=b[lenb]-0x37;else tmp=b[lenb]-0x30;
tmp+=flag;
}
if(tmp%16>=10) c[lenc]=bas[tmp%16-10];else c[lenc]=tmp%16+0x30;
flag=tmp/16;
lenc--;
lena--;
lenb--;
tmp2--;
}
if(lenc>0) c[lenc]=flag+0x30;
}
int main ()
{
char a[]="abcd4567890";
char b[]="987654abcdef";
char c[32];
int i;
for(i=0;i<32;i++) c[i]=0x20;
add(a,b,c);
printf("%s\n",c);
return 0;
}