9
lfpgbnlzyn
c
s
w
r
m
q
y
yinfblfcdhidphyfvgkxyuwomahiibbhnigdslsguhjkplibnhhrshtekwgefxeugyyyyy
 6
u
p
m
z
v
vv
 4
qe
nd
iqryhukieskfvaeettersinksrmazelxtgvartuz
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
 6
nf
ysvchtjkfgsbyfzxjaykey
advqnf
wl
pi
ppppfvvmaebvhkoagppppp
 3
j
k
kkailgwqnxtdsttkkkkkkk
 4
o
yhnx
e
ennn
 10
j
dyfu
udzj
wwow
xtnw
f
c
q
o
gggg
 6
w
g
c
j
y
f
 4
r
o
w
wwwwwwwwww
 2
zxwp
ppppctfisvflhtjggg
 5
m
g
u
t
tttt
 2
n
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
 3
lt
en
eeeeeeeeee
 4
vr
hp
l
llbn

7 5 541 10 10 4 4 1 21 5 9 93 21 3
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n;
		String ps[], prod= "";
		n = sc.nextInt();
		ps = new String[n];
		for(int i=0;i<n;i++)
		{	ps[i]=sc.next();
			//System.out.println("\t"+ beauty(ps[i]));
			prod = mult(prod,ps[i]);
		}
		System.out.println(prod);
		System.out.println(beauty(prod));
	}
	
	public static String mult(String a,String b)
	{	String p = b;
		for(int i=0;i<a.length();i++)
		{	p += a.charAt(i) + b;  
		}
		return p;
	}
	
	public static int beauty(String a)
	{	int max = 1;
		char rep;
		int b=1; 
		char c = a.charAt(0);
		for(int i=1;i<a.length();i++)
		{	if(c==a.charAt(i))
			{	b++;
				if(b>max)
				{	max = b;
					rep = c;
				}		
			}
			else
			{	b=1;
				c = a.charAt(i);
			}
		}
		return max;
	}
}
