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.io.*;
import java.math.BigInteger;
import java.util.*;

public class A implements Runnable {
	FastReader scn;
	PrintWriter out;
	String INPUT ="2\r\n" + 
			"bnn\r\n" + 
			"a\r\n" + 
			"";

	

	void solve(){
		int n = scn.nextInt();
		/*Pair p[] =  new Pair[n+1];
		p[0] = new Pair(0,0);
		for(int i = 1;i<=n;i++)
		{
			p[i]=new Pair(scn.nextLong(),scn.nextLong());
		}
		//long ans = 1;
		/*long t2 = 0;
		long temp = 11;
		/*
		for(int i = 1;i<=n;i++)
		{
			long last =p[i-1].a*10+p[i-1].b;
			t2 = last/11;
			last=last%10;
			long num =p[i].a*10+p[i].b;
			temp = num/11;
			num=num%10;
			if(temp<=p[i].b)//&&last>=p[i-1].b)
				ans+=temp-t2;
			
		}
		out.println(ans);
		
		BigInteger ans = new BigInteger("1");
		BigInteger last = new BigInteger("1"),num =new BigInteger("1");
		for(int i = 1;i<=n;i++)
		{
			last = last.multiply(BigInteger.valueOf(p[i-1].a*10+p[i-1].b));
			
			BigInteger t2 = last.divide(BigInteger.valueOf(11));
			last = last.mod(BigInteger.valueOf(10));
			num = num.multiply(BigInteger.valueOf(p[i].a*10+p[i].b));
			BigInteger temp= num.divide(BigInteger.valueOf(11));
			num =num.mod(BigInteger.valueOf(10));
			if(BigInteger.valueOf(p[i].b).compareTo(temp)>=0&&last.compareTo(BigInteger.valueOf(p[i-1].b))>=0)
				ans=ans.add(temp.subtract(t2));
			
		}
		out.println(ans);
		*/
		String[] s = new String[n];
		for(int i = 0;i<n;i++)
			s[i]= scn.nextLine();
		
		
		
		for(int i =0;i<n-1;i++)
		{
			StringBuilder temp=new StringBuilder();
			for(int j =0;j<s[i].length();j++)
			{
				temp.append(s[i+1]+s[i].charAt(j));
			}
			temp.append(s[i+1]);
			s[i+1]=temp.toString();
		
			
		}
		
		out.println(s[n-1]);
		long ans,final_ans;
		ans=0;
		final_ans=0;
		char []array = s[n-1].toCharArray();
		for(int i = 1;i<s[n-1].length();i++)
		{
			if(array[i]==array[i-1])
				ans++;
			else
				ans=1;
			final_ans = Math.max(ans, final_ans);
		}
		
		out.println(final_ans);
		
		
		
	} 
	static class Pair
	{
	    long a;
	    long b;
	   
	    Pair(long a,long b)
	    {
	        this.a = a;
	        this.b = b;
	    }
	}
	static class Compare
	{
		static void compare(Pair ar[])
		{
			Arrays.sort(ar, new Comparator<Pair>(){
				@Override
				public int compare(Pair p1,Pair p2)
				{
					return (int) (p1.a-p2.a);
				}
			});
		}
	}
	
	public static int[] radixSort(int[] f){ return radixSort(f, f.length); }
	int[][] packU(int n, int[] from, int[] to) {
		int[][] g = new int[n][];
		int[] p = new int[n];
		for (int f : from)
			p[f]++;
		for (int t : to)
			p[t]++;
		for (int i = 0; i < n; i++)
			g[i] = new int[p[i]];
		for (int i = 0; i < from.length; i++) {
			g[from[i]][--p[from[i]]] = to[i];
			g[to[i]][--p[to[i]]] = from[i];
		}
		return g;
	}

	
	public static int[] radixSort(int[] f, int n)
	{
		int[] to = new int[n];
		{
			int[] b = new int[65537];
			for(int i = 0;i < n;i++)b[1+(f[i]&0xffff)]++;
			for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
			for(int i = 0;i < n;i++)to[b[f[i]&0xffff]++] = f[i];
			int[] d = f; f = to;to = d;
		}
		{
			int[] b = new int[65537];
			for(int i = 0;i < n;i++)b[1+(f[i]>>>16)]++;
			for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
			for(int i = 0;i < n;i++)to[b[f[i]>>>16]++] = f[i];
			int[] d = f; f = to;to = d;
		}
		return f;
	}

	public void run() {
		long time = System.currentTimeMillis();
		boolean oj = System.getProperty("ONLINE_JUDGE") != null;
		out = new PrintWriter(System.out);
		scn = new FastReader(oj);
		solve();
		out.flush();
		if (!oj) {
			System.out.println(Arrays.deepToString(new Object[] { System.currentTimeMillis() - time + " ms" }));
		}
	}

	public static void main(String[] args) {
		new Thread(null, new A(), "Main", 1 << 26).start();
	}

	class FastReader {
		InputStream is;

		public FastReader(boolean onlineJudge) {
			is = onlineJudge ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		}

		byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;

		int readByte() {
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf) {
				ptrbuf = 0;
				try {
					lenbuf = is.read(inbuf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}

		boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		int skip() {
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b))
				;
			return b;
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		char nextChar() {
			return (char) skip();
		}

		String next() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		String nextLine() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while ((!isSpaceChar(b) || b == ' ')) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		char[] next(int n) {
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b))) {
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		int nextInt() {
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		long nextLong() {
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		char[][] nextMatrix(int n, int m) {
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = next(m);
			return map;
		}

		int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}
		void printArray(long[] k)
		{
			for(int i =0;i<k.length;i++)
				out.print(k[i]);
		}
		ArrayList<Integer> nArray(int n) {
			ArrayList<Integer> a = new ArrayList<>();
			for (int i = 0; i < n; i++)
				a.add(nextInt());
			
			return a;
		}

		long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		int[][] next2DInt(int n, int m) {
			int[][] arr = new int[n][];
			for (int i = 0; i < n; i++) {
				arr[i] = nextIntArray(m);
			}
			return arr;
		}

		long[][] next2DLong(int n, int m) {
			long[][] arr = new long[n][];
			for (int i = 0; i < n; i++) {
				arr[i] = nextLongArray(m);
			}
			return arr;
		}

		long[] shuffle(long[] array) {
			Random r = new Random();
			for (int i = 1, j; i < array.length; i++) {
				j = r.nextInt(i);
				array[i] = array[i] ^ array[j];
				array[j] = array[i] ^ array[j];
				array[i] = array[i] ^ array[j];
			}
			return array;
		}

		int[] uniq(int[] arr) {
			Arrays.sort(arr);
			int[] rv = new int[arr.length];
			int pos = 0;
			rv[pos++] = arr[0];
			for (int i = 1; i < arr.length; i++) {
				if (arr[i] != arr[i - 1]) {
					rv[pos++] = arr[i];
				}
			}
			return Arrays.copyOf(rv, pos);
		}
		int[] reverse(int[] arr) {
			int l = 0, r = arr.length - 1;
			while (l < r) {
				arr[l] = arr[l] ^ arr[r];
				arr[r] = arr[l] ^ arr[r];
				arr[l] = arr[l] ^ arr[r];
				l++;
				r--;
			}
			return arr;
		}
		
	}
}