#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <queue>
#include <climits>
#define ssi set<string>::iterator

using namespace std;

struct str
{
    string s;
    const bool operator<(const str& rhs) const
    {
        return s<rhs.s;
    }
    str(){}
    str(string t)
    {
        s=t;
    }
    str(const char t[])
    {
        s=t;
    }
};

bool pocinje(ssi str1, const string& str2)
{
    if((str1->length())<str2.length())
        return 0;
    int i=0, l=str2.length();
    while((*str1)[i]==str2[i]&&i<l) i++;
    return i==l;
}

inline bool odgovara(ssi s, short ig)
{
    return ((*s).length()%2)==ig;
}

inline short pobednik(ssi s)
{
    return 1+s->length()%2;
}

set<string> pq;
int n;
char t[51];
bool nasao;
string rec;
bool slova[26];
const string sl[]={"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};
ssi resenja[26];

ssi dfs(string poc, short ig)
{
    //cerr<<poc<<", "<<ig<<endl;
    ssi it=pq.lower_bound(poc);
    if((it!=pq.end())&&(*it==poc))
    {
        return it;
    }
    ssi najduzi=it;
    ssi it2;
    //cerr<<"isprobavanje\n";
    while((it!=pq.end())&&(pocinje(it, poc)))
    {
        //cerr<<*it<<endl;
        if(odgovara(it, ig))
        {
            if(odgovara(it2=dfs(poc+(*it)[poc.length()], (ig+1)%2), ig))
            {
                return it2;
            }
            else
            {
                if(it->length()>najduzi->length())
                    najduzi=it;
            }
        }
        else
        {
            if(it->length()>najduzi->length())
                    najduzi=it;
        }
        ++it;
    }
    return dfs(poc+(*najduzi)[poc.length()], (ig+1)%2);
}

int main()
{
    freopen("igra.in", "r", stdin);
    freopen("igra.out", "w", stdout);
    scanf("%d", &n);
    for(int i=0;i<n;i++)
    {
        scanf("%s", t);
        pq.insert(t);
    }
    ssi it=pq.begin();
    ssi it2;
    string tmp=*it;
    for(++it;it!=pq.end();++it)
    {
        if(it->length()>tmp.length())
        {
            if(pocinje(it, tmp))
            {
                //cerr<<(*it)<<" pocinje sa "<<tmp<<endl;
                pq.erase(it);
                --it;
                //cout<<"izbrisao, na tom mestu je "<<*it<<endl;
            }
            else
                tmp=*it;
        }
    }
    /*cout<<endl;
    it=pq.begin();
    for(;it!=pq.end();++it)
    {
        cerr<<"!"<<(*it)<<endl;
    }
    cerr<<"dfs\n";
    while(1)
    {
        string s;
        cin>>s;
        cout<<*dfs(s, 1)<<endl;
    }
    getchar();*/
    int najkraca=INT_MAX, najduza=0;
    bool imapr=0;
    ssi rezp, rezg;
    it=pq.begin();
    for(;it!=pq.end();++it)
    {
        slova[(*it)[0]-'a']=1;
    }
    for(int i=0;i<26;i++)
    {
        if(slova[i])
        {
            resenja[i]=dfs(sl[i], 1);
            if(pobednik(resenja[i])==1&&((resenja[i]->length())<najkraca))
            {
                najkraca=resenja[i]->length();
                rezp=resenja[i];
                imapr=1;
            }
            else
            {
                if((resenja[i]->length())>najduza)
                {
                    rezg=resenja[i];
                    najduza=resenja[i]->length();
                }
            }
        }
    }
    if(imapr)
    {
        printf("1\n%s\n", rezp->c_str());
    }
    else
    {
        printf("2\n%s\n", rezg->c_str());
    }
    return 0;
}
