#include<stdio.h>
#define N 51
int add1(char first, char second){
int i=3;
if(first=='0' || first=='1' && second=='0' || second=='1'){
i = first + second - 2*'0';
}
return i;
}
int main(){
char first[N] = {'\0'}; //第一个数
char second[N] = {'\0'}; //第二个数
char resulte[N+1] = {'\0'}; //第三个数
int first1 = 0; //第一个数组的下标
int second1 = 0; //二
int resulte1 = 0; //三
int carry = 0; //进位数
scanf("%s", first);
scanf("%s", second);
first1 = strlen(first) - 1;
second1 = strlen(second) - 1;
if (first1 > second1)
{
resulte1 = first1;
}else{
resulte1 = second1;
}
resulte1[resulte1+1]='\0'; //虽然已经初始化,为了保险,同时,可以拓展为循环多几次干这个事情
while(second1>-1 && first1>-1){
carry = carry + add1(first[first1],second[second1]);
resulte[resulte1] = (char)(carry%2 + '0');
if(carry > 1){
carry = 1;
}else{
carry = 0;
}
first1--;
second1--;
resulte1--;
}
if(first1 > -1){
while(first1>-1){
resulte1[resulte1] = first[first1];
resulte1--;
first1--;
}
carry = 0;
}else(second1 > -1){
while(first1>-1){
resulte1[resulte1] = second[second1];
resulte1--;
first1--;
}
carry = 0;
}
if(carry > 0)
printf("%d\n", 1);
printf("%s\n", resulte);
return 0;
}
#define N 51
int add1(char first, char second){
int i=3;
if(first=='0' || first=='1' && second=='0' || second=='1'){
i = first + second - 2*'0';
}
return i;
}
int main(){
char first[N] = {'\0'}; //第一个数
char second[N] = {'\0'}; //第二个数
char resulte[N+1] = {'\0'}; //第三个数
int first1 = 0; //第一个数组的下标
int second1 = 0; //二
int resulte1 = 0; //三
int carry = 0; //进位数
scanf("%s", first);
scanf("%s", second);
first1 = strlen(first) - 1;
second1 = strlen(second) - 1;
if (first1 > second1)
{
resulte1 = first1;
}else{
resulte1 = second1;
}
resulte1[resulte1+1]='\0'; //虽然已经初始化,为了保险,同时,可以拓展为循环多几次干这个事情
while(second1>-1 && first1>-1){
carry = carry + add1(first[first1],second[second1]);
resulte[resulte1] = (char)(carry%2 + '0');
if(carry > 1){
carry = 1;
}else{
carry = 0;
}
first1--;
second1--;
resulte1--;
}
if(first1 > -1){
while(first1>-1){
resulte1[resulte1] = first[first1];
resulte1--;
first1--;
}
carry = 0;
}else(second1 > -1){
while(first1>-1){
resulte1[resulte1] = second[second1];
resulte1--;
first1--;
}
carry = 0;
}
if(carry > 0)
printf("%d\n", 1);
printf("%s\n", resulte);
return 0;
}