Go: package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() (int, error) {
	return strconv.Atoi(nextString())

}

func main() {
	scanner.Split(bufio.ScanWords)

	for {
		a, err := nextInt()
		if err != nil {
			break
		}
		b, _ := nextInt()

		s := a + b
		nDigits := int(math.Log10(float64(s))) + 1
		fmt.Println(nDigits)
	}
}

C++: #include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <stdlib.h>
using namespace std;

const int MAXN = 100100;
struct Edge
{
	int to,next;
}edge[MAXN*2];
int head[MAXN],tot;
int top[MAXN];//top[v]陦ィ遉コv謇?惠逧??體セ逧?。カ遶ッ闃らせ
int fa[MAXN]; //辷カ莠イ闃らせ
int deep[MAXN];//豺ア蠎ヲ
int num[MAXN];//num[v]陦ィ遉コ莉・v荳コ譬ケ逧?ュ先?逧?鰍轤ケ謨ー
int p[MAXN];//p[v]陦ィ遉コv荳主?辷カ莠イ闃らせ逧?ソ櫁セケ蝨ィ郤ソ谿オ譬台クュ逧?ス咲スョ
int fp[MAXN];//蜥継謨ー扈?嶌蜿?int son[MAXN];//驥榊?蟄?int pos;

void init()
{
	tot = 0;
	memset(head,-1,sizeof(head));
	pos = 0;
	memset(son,-1,sizeof(son));
}

inline void addedge(int u,int v)
{
	edge[tot].to = v;edge[tot].next = head[u];head[u] = tot++;
}

void dfs1(int u,int pre,int d) //隨ャ荳?″dfs豎ょ?fa,deep,num,son
{
	deep[u] = d;
	fa[u] = pre;
	num[u] = 1;
	for(int i = head[u];i != -1; i = edge[i].next)
	{
		int v = edge[i].to;
		if(v != pre)
		{
			dfs1(v,u,d+1);
			num[u] += num[v];
			if(son[u] == -1 || num[v] > num[son[u]])
				son[u] = v;
		}
	}
}

inline void getpos(int u,int sp) //隨ャ莠碁″dfs豎ょ?top蜥継
{
	top[u] = sp;
	if(son[u] != -1)
	{
		p[u] = pos++;
		fp[p[u]] = u;
		getpos(son[u],sp);
	}
	else
	{
		p[u] = pos++;
		fp[p[u]] = u;
		return;
	}
	for(int i = head[u] ; i != -1; i = edge[i].next)
	{
		int v = edge[i].to;
		if(v != son[u] && v != fa[u])
			getpos(v,v);
	}
}

//郤ソ谿オ譬?struct Node
{
	int l,r;
	long long sum;
	long long lazy;
}segTree1[MAXN<<2],segTree2[MAXN<<2];
inline void build(Node segTree[],int i,int l,int r)
{
	segTree[i].l = l;
	segTree[i].r = r;
	segTree[i].sum = 0;
	segTree[i].lazy =0;
	if(l == r)return;
	int mid =((l+r)>>1);
	build(segTree,i<<1,l,mid);
	build(segTree,(i<<1)|1,mid+1,r);
}

inline void push_up(Node segTree[],int i)
{
	segTree[i].sum= segTree[i<<1].sum+segTree[i<<1|1].sum;
}

inline void push_down(Node segTree[],int i){
	if(segTree[i].lazy){
		segTree[i<<1].lazy+=segTree[i].lazy;
		segTree[i<<1|1].lazy+=segTree[i].lazy;
		segTree[i<<1].sum+=(segTree[i<<1].r-segTree[i<<1].l+1)*segTree[i].lazy;
		segTree[i<<1|1].sum+=(segTree[i<<1|1].r-segTree[i<<1|1].l+1)*segTree[i].lazy;
		segTree[i].lazy=0;
	}
}

inline void update(Node segTree[],int i,int l,int r,int val)//譖エ譁ー蛹コ髣エ 
{
	if(segTree[i].l == l && segTree[i].r == r)
	{
		segTree[i].lazy+= val;
		segTree[i].sum+=(segTree[i].r-segTree[i].l+1)*val;
		return;
	}
	push_down(segTree,i);
	int mid = (segTree[i].l + segTree[i].r)>>1;
	if(r <= mid){
		update(segTree,i<<1,l,r,val);
	}
	else if(l>mid){
		update(segTree,(i<<1)|1,l,r,val);
	}
	else{
		update(segTree,i<<1,l,mid,val);
		update(segTree,i<<1|1,mid+1,r,val);
	} 
	push_up(segTree,i);
}

inline int query(Node segTree[],int i,int l,int r)//譟・隸「 
{
	if(segTree[i].l == l && segTree[i].r == r)
		return segTree[i].sum;
	push_down(segTree,i);
	int mid = (segTree[i].l + segTree[i].r)>>1;
	if(r <= mid){
		return query(segTree,i<<1,l,r);
	}
	else if(l>mid){
		return query(segTree,i<<1|1,l,r);
	}
	else {
		return query(segTree,i<<1,l,mid);
		return query(segTree,i<<1|1,mid+1,r);
	}
}

inline void add2(Node segTree[],int u,int v,int val)//譟・隸「u->v霎ケ逧?怙螟ァ蛟シ
{
	int f1 = top[u], f2 = top[v];
	int tmp = 0;
	while(f1 != f2)
	{
		if(deep[f1] < deep[f2])
		{
			swap(f1,f2);
			swap(u,v);
		}
		update(segTree,1,p[f1],p[u],val);
		u = fa[f1]; f1 = top[u];
	}
	if(u == v){
		return ;
	}
	if(deep[u] > deep[v]) swap(u,v);
	update(segTree,1,p[son[u]],p[v],val);
}

int find(Node segTree[],int u,int v)//譟・隸「u->v霎ケ逧?怙螟ァ蛟シ
{
	int f1 = top[u], f2 = top[v];
	int tmp = 0;
	while(f1 != f2)
	{
		if(deep[f1] < deep[f2])
		{
			swap(f1,f2);
			swap(u,v);
		}
		tmp = max(tmp,query(segTree,1,p[f1],p[u]));
		u = fa[f1]; f1 = top[u];
	}
	if(u == v)return tmp;
	if(deep[u] > deep[v]) swap(u,v);
	return max(tmp,query(segTree,1,p[son[u]],p[v]));
}

int e[MAXN][2];	
struct Re{
	char s[10];
	int u,v,k;
};
Re re[MAXN];

struct Re2{
	int l,r,k;
};
Re2 re2[MAXN];

int ans[2][MAXN];
int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    int T;
	int n,q;
	scanf("%d",&T);
	
	int _=0;
	int i;
	int u,v,pu,pv;
	while(T--)
	{
		init();
		scanf("%d%d",&n,&q);
		for(i = 0;i < n-1;i++)
		{
			scanf("%d%d",&e[i][0],&e[i][1]);
			addedge(e[i][0],e[i][1]);
			addedge(e[i][1],e[i][0]);
		}
		
		addedge(n+1,1);
		addedge(1,n+1); 
		
		dfs1(n+1,0,0);
		getpos(n+1,n+1);
		
		build(segTree1,1,0,pos-1);
		build(segTree2,1,0,pos-1);
		
		for(i=0;i<q;i++){
			scanf("%s%d%d%d",re[i].s,&re[i].u,&re[i].v,&re[i].k);
			if(re[i].s[3]=='2')add2(segTree2,re[i].u,re[i].v,re[i].k);
			else add2(segTree1,fa[re[i].u],re[i].v,re[i].k);
		}
		//邂礼噪譏ッ霎ケ
		for(i=0;i<n-1;i++){
			u=e[i][0],v=e[i][1];
			pu=p[u];
			pv=p[v];
			if(pu==v)ans[0][i]=query(segTree2,1,pu,pu);
			else ans[0][i]=query(segTree2,1,pv,pv);
		}
		//邂礼噪譏ッ轤ケ 
		for(i=1;i<=n;i++)ans[1][i]=query(segTree1,1,p[i],p[i]);
		
		printf("Case #%d:\n",++_);
		for(i=1;i<=n;i++){
			if(i!=1)printf(" ");
			printf("%d",ans[1][i]);
		}
		puts("");
		for(i=0;i<n-1;i++){
			if(i)printf(" ");
			printf("%d",ans[0][i]);
		}
		puts("");
	}
    return 0;
}

C++: #include<iostream>

int a,b;

int main(void)
{
	while( std::cin >> a >> b ){
		int i,j;
		for( i = 10, j = 1; ( a + b ) / i >= 1; i *= 10, j++){}

		std::cout << j << std::endl;
	}

	return 0;
}

C++: #include <bits/stdc++.h>
#include <cstdio>
using namespace std;

int a,b,c;
c = dainyuu()

int main() {
  while (c != EOF) {
    dainyuu();
    int i;
    a = a + b;
    while(a > 0) {
      a = a / 10;
      ++i;
    }
    
    cout << i << endl;
    
  }
}

int dainyuu() {
  cin >> a >> b;
}

C++: #include<iostream>
using namespace std;
int main (){
	int a,b,gou,p,i;
		gou=0;
		while(cin>>a>>b){
		gou=a+b;
		for(j=0;j<7;j++){
			if(gou>0){
				p++;
			}
			else if(gou<=0){
				break;
			}
			gou=gou/10;
		}
		cout<<p<<endl;
		p=0;
		}
	return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;

int main()
{
	int a, b, i = 10;
	while (cin >> a >> b) {
		for (int j = 1;; j++) {
			if (a + b < (int)pow(10, j)) {
				cout << j << endl; 
				break;
			}
		}
	}
	return 0;
}

C++: #include<bits\stdc++.h>
using namespace std;
int main(){
	int a,b;
	while(cin>>a>>b){
		int sum=a+b,cnt=0;
		while(sum)	sum/=10,cnt++;
		cout<<cnt<<endl;
	}
	return 0;
}

C++: #include <stdio.h>
int main()
{
  int a,b,sum,cou;
  while( scanf("%d %d",&a,&b)!=EOF ){
    sum=a+b;
    cou=0;
    while(1){
      if(sum<10)break;
      sum=sum/10;
      cou++;
    }
    printf("%d",cou+1);
  }
  return 0;
}

C++: #include<iostream>

using namespace std;

main(){
  int i=0;
  double a,b;
  double sum;
  while(cin >> a >> b){
    
    sum = a+b;
    
    while(sum>1){
	i++;
	//cout << i << endl;
	sum/=10;
    }
      cout << i << endl;
      i=0;
  }
  return 0;
  
}

C++: #include<iostream>
using namespace std;
int main(){
  int a,b;
  int c=a+b;
  int d=0
  cin >> a >> b;
  while(c!=0){
    c=c/10;
    d=d+1;
  }
  cout << d << endl;
}

C++: #include <iostream>
#include <algorithm>
#include <string.h>
#include <math.h>
using namespace std;

int main(){
    int a,b;
    while((cin >> a >> b)){
        int cnt = 0;
        int n = a+b;
        if(n!=0)for(cnt=0;n>0;cnt++)n/=10;
        else cnt = 1;
        cout<<cnt<<endl;
    }
    return 0;
}