#include<bits/stdc++.h>                   /*--------------->Logic%2==0---------------->*/
#define CASE(t)                 printf("Case %d: ",t)
#define gcd(a,b)                __gcd(a,b)
#define lcm(a,b)                ((a)*(b))/gcd(a,b)
#define PI                      2*acos(0.0)
#define ll                      long long int
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n,m,p=0,i,j;
    cin>>n>>m;
    vector<string>vv,sec;
    string s,ss,sss,a,v="",fst="";
    for(i=0; i<n; i++)
    {
        cin>>s;
        a=s;
        reverse(a.begin(),a.end());
        ss=a;
        if(ss==s && p==0)
        {
            v+=s;
            p=1;
        }
        else
        {
            vv.push_back(s);
        }

    }
    string x="123",t;
    for(i=0; i<vv.size()-1; i++)
    {
        reverse(vv[i].begin(),vv[i].end());
        sss=vv[i];

        for(j=i+1; j<vv.size(); j++)
        {

            if(sss==vv[j])
            {
                sec.push_back(sss);
                reverse(vv[j].begin(),vv[j].end());
                t=vv[j];
                fst+=t;
                x=x+'6';
                vv[i]=x;
                x=x+'7';
                vv[j]=x;
                break;
            }
        }
    }
    string mx_len="";
    if(fst.size()>0)
    {
        mx_len+=fst;
    }
    if(v.size()>0)
    {
        mx_len+=v;
    }
    if(sec.size()>0)
    {
        for(i=sec.size()-1;i>=0;i--)
        {
            mx_len+=sec[i];
        }
    }
    cout<<mx_len.size()<<endl;
    cout<<mx_len<<endl;
    /*---------->HaPpY CoDiNg----------->*/
    return 0;
}


#include<bits/stdc++.h>                   /*--------------->Logic%2==0---------------->*/
#define CASE(t)                 printf("Case %d: ",t)
#define gcd(a,b)                __gcd(a,b)
#define lcm(a,b)                ((a)*(b))/gcd(a,b)
#define PI                      2*acos(0.0)
#define ll                      long long int
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n,m,p=0,i,j;
    cin>>n>>m;
    vector<string>vv,sec;
    string s,ss,sss,a,v="",fst="";
    for(i=0; i<n; i++)
    {
        cin>>s;
        a=s;
        reverse(a.begin(),a.end());
        ss=a;
        if(ss==s && p==0)
        {
            v+=s;
            p=1;
        }
        else
        {
            vv.push_back(s);
        }

    }
    if(n==1 && p==1)
    {
        cout<<v<<endl;
        return 0;
    }
    if(n==1 && p==0)
    {
        cout<<0<<endl;
        return 0;
    }
    string x="123",t;
    for(i=0; i<vv.size()-1; i++)
    {
        reverse(vv[i].begin(),vv[i].end());
        sss=vv[i];

        for(j=i+1; j<vv.size(); j++)
        {

            if(sss==vv[j])
            {
                sec.push_back(sss);
                reverse(vv[j].begin(),vv[j].end());
                t=vv[j];
                fst+=t;
                x=x+'6';
                vv[i]=x;
                x=x+'7';
                vv[j]=x;
                break;
            }
        }
    }
    string mx_len="";
    if(fst.size()>0)
    {
        mx_len+=fst;
    }
    if(v.size()>0)
    {
        mx_len+=v;
    }
    if(sec.size()>0)
    {
        for(i=sec.size()-1;i>=0;i--)
        {
            mx_len+=sec[i];
        }
    }
    cout<<mx_len.size()<<endl;
    cout<<mx_len<<endl;
    /*---------->HaPpY CoDiNg----------->*/
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
signed main(){
    fast;
    int n,m;
    cin >> n >> m;
    vector<string> v(n);
    string s1,s2;
    for(int i=0;i<n;i++){
        cin >> v[i];
    }
    int c=0;
    vector<pair<int,int> > pp;
    set<int> s;
    for(int i=0;i<n-1;i++){
        s2=v[i];
        reverse(s2.begin(),s2.end());
        if(s.empty() || s.count(i)==0)
        for(int j=i+1;j<n;j++)
            if(v[j]==s2){
                c++;
                pp.push_back(make_pair(i,j));
                s.insert(i);
                s.insert(j);
                break;
            }
    }
    int po=-1;
    for(int i=0;i<n;i++){
        if(s.empty() || s.count(i)==0){
            s1=v[i];
            int ii=1;
            for(int j=0,k=m-1;j<k;j++,k--){
                if(s1[j]!=s1[k]){
                    ii=0;
                    break;
                }
            }
            if(ii){
                po=i;
                break;
            }
        }
    }
    if(c==0 && po==-1){
        cout <<0;
        return 0;
    }
    vector<string> ans;
    for(int i=0;i<c;i++){
        ans.push_back(v[pp[i].first]);
    }
    if(po!=-1){
        ans.push_back(v[po]);
    }
    for(int i=c-1;i>=0;i--)
        ans.push_back(v[pp[i].second]);
    int sz=ans.size()*m;
    cout<< sz<< endl;
    for(int i=0;i<sz;i++)
        cout << ans[i];
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
signed main(){
    fast;
    int n,m;
    cin >> n >> m;
    vector<string> v(n);
    string s1,s2;
    for(int i=0;i<n;i++){
        cin >> v[i];
    }
    int c=0;
    vector<pair<int,int> > pp;
    for(int i=0;i<n-1;i++){
        s2=v[i];
        reverse(s2.begin(),s2.end());
        for(int j=i+1;j<n;j++){
            if(v[j]==s2){
                c++;
                pp.push_back(make_pair(i,j));
                break;
            }
        }
    }
    int po=-1;
    for(int i=0;i<n;i++){
            s1=v[i];
            int ii=1;
            for(int j=0,k=m-1;j<=k;j++,k--){
                if(s1[j]!=s1[k]){
                    ii=0;
                    break;
                }
            }
            if(ii){
                po=i;
                break;
            }
    }
    if(pp.size()==0 && po==-1){
        cout <<0;
        return 0;;
    }

    vector<string> ans;
    for(int i=0;i<pp.size();i++){
        ans.push_back(v[pp[i].first]);
    }
    if(po!=-1){
        ans.push_back(v[po]);
    }
    for(int i=pp.size()-1;i>=0;i--)
        ans.push_back(v[pp[i].second]);
    cout<< ans.size()*m<< endl;
    for(int i=0;i<ans.size();i++)
        cout << ans[i];
    cout << endl;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
signed main(){
    fast;
    int n,m;
    cin >> n >> m;
    vector<string> v(n);
    string s1,s2;
    for(int i=0;i<n;i++){
        cin >> v[i];
    }
    int c=0;
    vector<pair<int,int> > pp;
    set<int> s;
    for(int i=0;i<n-1;i++){
        s2=v[i];
        reverse(s2.begin(),s2.end());
        for(int j=i+1;j<n;j++)
            if(v[j]==s2){
                c++;
                pp.push_back(make_pair(i,j));
                s.insert(i);
                s.insert(j);
                break;
            }
    }
    int po=-1;
    for(int i=0;i<n;i++){
        if(s.count(i)==0){
            s1=v[i];
            int ii=1;
            for(int j=0,k=m-1;j<=k;j++,k--){
                if(s1[j]!=s1[k]){
                    ii=0;
                    break;
                }
            }
            if(ii){
                po=i;
                break;
            }
        }
    }
    if(pp.size()==0 && po==-1){
        cout <<0;
        return 0;;
    }

    vector<string> ans;
    for(int i=0;i<pp.size();i++){
        ans.push_back(v[pp[i].first]);
    }
    if(po!=-1){
        ans.push_back(v[po]);
    }
    for(int i=pp.size()-1;i>=0;i--)
        ans.push_back(v[pp[i].second]);
    cout<< ans.size()*m<< endl;
    for(int i=0;i<ans.size();i++)
        cout << ans[i];
    cout << endl;
}


#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
signed main(){
    fast;
    int n,m;
    cin >> n >> m;
    vector<string> v(n);
    string s1,s2;
    for(int i=0;i<n;i++){
        cin >> v[i];
    }
    int c=0;
    vector<pair<int,int> > pp;
    for(int i=0;i<n-1;i++){
        s2=v[i];
        reverse(s2.begin(),s2.end());
        for(int j=i+1;j<n;j++){
            if(v[j]==s2){
                c++;
                pp.push_back(make_pair(i,j));
                break;
            }
        }
    }
    int po=-1;
    for(int i=0;i<n;i++){
            s1=v[i];
            s2=s1;
            reverse(s2.begin(),s2.end());
            if(s1==s2)
                po=i;
    }
    if(pp.size()==0 && po==-1){
        cout <<0;
        return 0;
    }

    vector<string> ans;
    if(pp.size()==0){
        cout <<m <<endl<<v[po];
        return 0;
    }
    for(int i=0;i<pp.size();i++){
        ans.push_back(v[pp[i].first]);
    }
    if(po!=-1){
        ans.push_back(v[po]);
    }
    for(int i=pp.size()-1;i>=0;i--)
        ans.push_back(v[pp[i].second]);
    int sz=ans.size()*m;
    cout<<sz << endl;
    for(int i=0;i<ans.size();i++)
        cout << ans[i];
}


#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
signed main(){
    fast;
    int n,m;
    cin >> n >> m;
    vector<string> v(n);
    string s1,s2;
    for(int i=0;i<n;i++){
        cin >> v[i];
    }
    int c=0;
    vector<pair<int,int> > pp;
    for(int i=0;i<n-1;i++){
        s2=v[i];
        reverse(s2.begin(),s2.end());
        for(int j=i+1;j<n;j++)
            if(v[j]==s2){
                c++;
                pp.push_back(make_pair(i,j));
                break;
            }
    }
    int po=-1;
    for(int i=0;i<n;i++){
            s1=v[i];
            int ii=1;
            for(int j=0,k=m-1;j<k;j++,k--){
                if(s1[j]!=s1[k]){
                    ii=0;
                    break;
                }
            }
            if(ii){
                po=i;
                break;
            }
    }
    if(c==0 && po==-1){
        cout <<0;
        return 0;
    }
    vector<string> ans;
    for(int i=0;i<c;i++){
        ans.push_back(v[pp[i].first]);
    }
    if(po!=-1){
        ans.push_back(v[po]);
    }
    for(int i=c-1;i>=0;i--)
        ans.push_back(v[pp[i].second]);
    int sz=ans.size()*m;
    cout<< sz<< endl;
    for(int i=0;i<sz;i++)
        cout << ans[i];
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
signed main(){
    fast;
    int n,m;
    cin >> n >> m;
    vector<string> v(n);
    string s1,s2;
    for(int i=0;i<n;i++){
        cin >> v[i];
    }
    int c=0;
    vector<pair<int,int> > pp;
    set<int> s;
    for(int i=0;i<n-1;i++){
        s2=v[i];
        reverse(s2.begin(),s2.end());
        if(s.empty() || s.count(i)==0)
        for(int j=i+1;j<n;j++)
            if(v[j]==s2){
                c++;
                pp.push_back(make_pair(i,j));
                s.insert(i);
                s.insert(j);
                break;
            }
    }
    int po=-1;
    for(int i=0;i<n;i++){
        if(s.count(i)==0){
            s1=v[i];
            int ii=1;
            for(int j=0,k=m-1;j<=k;j++,k--){
                if(s1[j]!=s1[k]){
                    ii=0;
                    break;
                }
            }
            if(ii){
                po=i;
                break;
            }
        }
    }
    if(pp.size()==0 && po==-1){
        cout <<0;
        return 0;
    }
    vector<string> ans;
    for(int i=0;i<pp.size();i++){
        ans.push_back(v[pp[i].first]);
    }
    if(po!=-1){
        ans.push_back(v[po]);
    }
    for(int i=pp.size()-1;i>=0;i--)
        ans.push_back(v[pp[i].second]);
    cout<< ans.size()*m<< endl;
    for(int i=0;i<ans.size();i++)
        cout << ans[i];
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
signed main(){
    fast;
    int n,m;
    cin >> n >> m;
    vector<string> v(n);
    string s1,s2;
    for(int i=0;i<n;i++){
        cin >> v[i];
    }
    int c=0;
    vector<pair<int,int> > pp;
    for(int i=0;i<n-1;i++){
        s2=v[i];
        reverse(s2.begin(),s2.end());
        for(int j=i+1;j<n;j++){
            if(v[j]==s2){
                c++;
                pp.push_back(make_pair(i,j));
                break;
            }
        }
    }
    int po=-1;
    for(int i=0;i<n;i++){
            s1=v[i];
            s2=s1;
            reverse(s2.begin(),s2.end());
            if(s1==s2)
                po=i;
    }
    if(pp.size()==0 && po==-1){
        cout <<0;
        return 0;
    }

    vector<string> ans;
    for(int i=0;i<pp.size();i++){
        ans.push_back(v[pp[i].first]);
    }
    if(po!=-1){
        ans.push_back(v[po]);
    }
    for(int i=pp.size()-1;i>=0;i--)
        ans.push_back(v[pp[i].second]);
    cout<< ans.size()*m<< endl;
    for(int i=0;i<ans.size();i++)
        cout << ans[i];
    cout << endl;
}


/*------------------------Original Copyright belongs to-------------------------/
!      																			!
!      ##  ##                                                		##  ##	    !
!      #   #             											#   #		!
!      				 ###  ####  ###   ###     ##         #                      !
!					#     #  #  #  #  #  #   #  #       ##                      !
!					#	  #  #  ###   ###    ####        #                      !
!					#     #  #  #  #  #  #   #  #        #                      !
!					 ###  ####  ###   #   #  #  #  ###  ### 			        !
!                                                                               !
/------------------------------------------------------------------------------*/
#include<bits/stdc++.h>
using namespace std;
//------------Template begins--------------------//
#define ss string
#define last(s) s.length()-1
#define lli long long int
#define ld long double
#define v(type) vector<type>
#define pr(type1,type2) pair<type1,type2>
#define ma(type1,type2) map<type1,type2>
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front
#define mp make_pair
#define L(i,start,end) for(lli i=start;i<=end;i++)
#define R(i,start,end) for(lli i=start;i>=end;i--)
#define inp(var,start,end,array) for(var=start;var<=end;var++) cin>>array[var];
#define whatIs(x) cout<<#x<<" is "<<x<<endl
#define dbg1D(i,start,end,arr) for(lli i=start;i<=end;i++) cout<<i<<"th : "<<arr[i]<<endl;
#define dbg2D(i,j,s1,e1,s2,e2,arr) for (lli i=s1;i<=e1;i++) {cout<<i<<"th :"; for(lli j=s2;j<=e2;j++)cout<<arr[i][j]<<" ";cout<<endl;}

lli dx[4]={-1, 0, 0, +1};
lli dy[4]={0, -1, +1, 0};
const lli LINF = 1e18;
const lli INF = 1e9;
const lli mod = 1e9+7;
lli power(lli a,lli b,lli m){ if(b==0) return 1; if(b==1) return a%m;
 		lli t=power(a,b/2,m); t=(t*t)%m; if(b&1) t=(t*a)%m; return t;}
lli modInverse(lli a, lli m) { return power(a, m-2, m); }
//---------------Template ends------------------//
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	#ifndef ONLINE_JUDGE
	freopen("ip.txt","r",stdin);
	freopen("op.txt","w",stdout);
	#endif
//#################### CATCH HERE ##########################
   	//* Uncomment if t test cases
	lli t;
	//cin>>t;
	t=1;
	while(t--)
	{
		lli n,m,i,j;
		cin>>n>>m;
		ss ip[n+1];
		lli fre[n+1][26]={0};
		set<lli> used;
		vector<lli> con;
		L(i,1,n)
		{
			cin>>ip[i];
			L(j,0,m-1)
				fre[i][ip[i].at(j)-'a']++;
		}
		L(i,1,n)
		{
			if(used.find(i)!=used.end())
				continue;
			L(j,i+1,n)
			{
				if(used.find(j)!=used.end())
					continue;
				bool poss=true;
				L(k,0,25)
				{
					if(fre[i][k]!=fre[j][k])
					{
						poss=false;
						break;
					}
				}
				if(poss)
				{
					used.insert(i);
					used.insert(j);
					con.pb(i);
				}
			}
		}
		vector<ss> pal;
		L(i,1,n)
		{
			if(used.find(i)==used.end())
			{
				bool poss=true;
				bool even=false;
				lli sz=m;
				if(sz%2==0)
					even=true;
				lli count=0;
				ss tr="";
				L(j,0,25)
				{
					L(k,1,(fre[i][j]+1)/2)
					{
						tr+=char('a'+j);
					}
					if(fre[i][j]%2!=0)
					{
						count++;
						if((even&&count)||((!even)&&(count>1)))
						{
							poss=false;
							break;
						}
					}
				}
				if(poss)
				{
					//cout<<tr<<endl;
					if(even)
						tr+=tr;
					else
						tr+=(tr.substr(1,m/2));
					pal.pb(tr);
					break;
				}
			}
		}

		ss ans;
		lli s2=con.size();
		L(i,0,s2-1)
		{
			L(j,0,m-1)
				ans+=ip[con[i]].at(j);
		}
		lli gap=0;
		if(pal.size()>0)
		{
			ans+=pal[0];
			gap=pal[0].length();
		}
		lli lr=ans.length();
		R(i,lr-gap-1,0)
			ans+=ans.at(i);
			cout<<ans.length()<<endl;
			cout<<ans<<endl;
	}
	//*/
	//cout<<ans<<endl;
//##########################################################
	return 0;
}


/*------------------------Original Copyright belongs to-------------------------/
!      																			!
!      ##  ##                                                		##  ##	    !
!      #   #             											#   #		!
!      				 ###  ####  ###   ###     ##         #                      !
!					#     #  #  #  #  #  #   #  #       ##                      !
!					#	  #  #  ###   ###    ####        #                      !
!					#     #  #  #  #  #  #   #  #        #                      !
!					 ###  ####  ###   #   #  #  #  ###  ### 			        !
!                                                                               !
/------------------------------------------------------------------------------*/
#include<bits/stdc++.h>
using namespace std;
//------------Template begins--------------------//
#define ss string
#define last(s) s.length()-1
#define lli long long int
#define ld long double
#define v(type) vector<type>
#define pr(type1,type2) pair<type1,type2>
#define ma(type1,type2) map<type1,type2>
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front
#define mp make_pair
#define L(i,start,end) for(lli i=start;i<=end;i++)
#define R(i,start,end) for(lli i=start;i>=end;i--)
#define inp(var,start,end,array) for(var=start;var<=end;var++) cin>>array[var];
#define whatIs(x) cout<<#x<<" is "<<x<<endl
#define dbg1D(i,start,end,arr) for(lli i=start;i<=end;i++) cout<<i<<"th : "<<arr[i]<<endl;
#define dbg2D(i,j,s1,e1,s2,e2,arr) for (lli i=s1;i<=e1;i++) {cout<<i<<"th :"; for(lli j=s2;j<=e2;j++)cout<<arr[i][j]<<" ";cout<<endl;}

lli dx[4]={-1, 0, 0, +1};
lli dy[4]={0, -1, +1, 0};
const lli LINF = 1e18;
const lli INF = 1e9;
const lli mod = 1e9+7;
lli power(lli a,lli b,lli m){ if(b==0) return 1; if(b==1) return a%m;
 		lli t=power(a,b/2,m); t=(t*t)%m; if(b&1) t=(t*a)%m; return t;}
lli modInverse(lli a, lli m) { return power(a, m-2, m); }
//---------------Template ends------------------//
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	#ifndef ONLINE_JUDGE
	freopen("ip.txt","r",stdin);
	freopen("op.txt","w",stdout);
	#endif
//#################### CATCH HERE ##########################
   	//* Uncomment if t test cases
	lli t;
	//cin>>t;
	t=1;
	while(t--)
	{
		lli n,m,i,j;
		cin>>n>>m;
		ss ip[n+1];
		lli fre[n+1][26]={0};
		set<lli> used;
		vector<lli> con;
		L(i,1,n)
		{
			cin>>ip[i];
			L(j,0,m-1)
				fre[i][ip[i].at(j)-'a']++;
		}
		L(i,1,n)
		{
			if(used.find(i)!=used.end())
				continue;
			L(j,i+1,n)
			{
				if(used.find(j)!=used.end())
					continue;
				bool poss=true;
				L(k,0,25)
				{
					if(fre[i][k]!=fre[j][k])
					{
						poss=false;
						break;
					}
				}
				if(poss)
				{
					used.insert(i);
					used.insert(j);
					con.pb(i);
				}
			}
		}
		vector<ss> pal;
		L(i,1,n)
		{
			if(used.find(i)==used.end())
			{
				bool poss=true;
				bool even=false;
				lli sz=m;
				if(sz%2==0)
					even=true;
				lli count=0;
				ss tr="";
				char ch1;
				L(j,0,25)
				{
					if(fre[i][j]%2!=0)
						ch1=(j+'a');
					L(k,1,(fre[i][j])/2)
					{
						tr+=char('a'+j);
					}
					if(fre[i][j]%2!=0)
					{
						count++;
						if((even&&count)||((!even)&&(count>1)))
						{
							poss=false;
							break;
						}
					}
				}
				if(((!even)&&(count==0)))
					poss=false;
				if(poss)
				{
					sort(tr.begin(),tr.end());
					ss s3=tr;
					reverse(s3.begin(),s3.end());
					if(even)
						tr+=s3;
					else
					{
						tr+=ch1;
						tr+=s3;
					}
					//cout<<tr<<endl;
					pal.pb(tr);
					break;
				}
			}
		}

		ss ans="";
		lli s2=con.size();
		L(i,0,s2-1)
		{
			L(j,0,m-1)
				ans+=ip[con[i]].at(j);
		}
		lli gap=0;
		if(pal.size()>0)
		{
			ans+=pal[0];
			gap=pal[0].length();
		}
		lli lr=ans.length();
		R(i,lr-gap-1,0)
			ans+=ans.at(i);
			cout<<ans.length()<<endl;
			cout<<ans<<endl;
	}
	//*/
	//cout<<ans<<endl;
//##########################################################
	return 0;
}


/*------------------------Original Copyright belongs to-------------------------/
!      																			!
!      ##  ##                                                		##  ##	    !
!      #   #             											#   #		!
!      				 ###  ####  ###   ###     ##         #                      !
!					#     #  #  #  #  #  #   #  #       ##                      !
!					#	  #  #  ###   ###    ####        #                      !
!					#     #  #  #  #  #  #   #  #        #                      !
!					 ###  ####  ###   #   #  #  #  ###  ### 			        !
!                                                                               !
/------------------------------------------------------------------------------*/
#include<bits/stdc++.h>
using namespace std;
//------------Template begins--------------------//
#define ss string
#define last(s) s.length()-1
#define lli long long int
#define ld long double
#define v(type) vector<type>
#define pr(type1,type2) pair<type1,type2>
#define ma(type1,type2) map<type1,type2>
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front
#define mp make_pair
#define L(i,start,end) for(lli i=start;i<=end;i++)
#define R(i,start,end) for(lli i=start;i>=end;i--)
#define inp(var,start,end,array) for(var=start;var<=end;var++) cin>>array[var];
#define whatIs(x) cout<<#x<<" is "<<x<<endl
#define dbg1D(i,start,end,arr) for(lli i=start;i<=end;i++) cout<<i<<"th : "<<arr[i]<<endl;
#define dbg2D(i,j,s1,e1,s2,e2,arr) for (lli i=s1;i<=e1;i++) {cout<<i<<"th :"; for(lli j=s2;j<=e2;j++)cout<<arr[i][j]<<" ";cout<<endl;}

lli dx[4]={-1, 0, 0, +1};
lli dy[4]={0, -1, +1, 0};
const lli LINF = 1e18;
const lli INF = 1e9;
const lli mod = 1e9+7;
lli power(lli a,lli b,lli m){ if(b==0) return 1; if(b==1) return a%m;
 		lli t=power(a,b/2,m); t=(t*t)%m; if(b&1) t=(t*a)%m; return t;}
lli modInverse(lli a, lli m) { return power(a, m-2, m); }
//---------------Template ends------------------//
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	#ifndef ONLINE_JUDGE
	freopen("ip.txt","r",stdin);
	freopen("op.txt","w",stdout);
	#endif
//#################### CATCH HERE ##########################
   	//* Uncomment if t test cases
	lli t;
	//cin>>t;
	t=1;
	while(t--)
	{
		lli n,m,i,j;
		cin>>n>>m;
		ss ip[n+1];
		lli fre[n+1][26]={0};
		set<lli> used;
		vector<lli> con;
		L(i,1,n)
		{
			cin>>ip[i];
			L(j,0,m-1)
				fre[i][ip[i].at(j)-'a']++;
		}
		L(i,1,n)
		{
			if(used.find(i)!=used.end())
				continue;
			L(j,i+1,n)
			{
				if(used.find(j)!=used.end())
					continue;
				bool poss=true;
				L(k,0,25)
				{
					if(fre[i][k]!=fre[j][k])
					{
						poss=false;
						break;
					}
				}
				if(poss)
				{
					used.insert(i);
					used.insert(j);
					con.pb(i);
				}
			}
		}
		vector<ss> pal;
		L(i,1,n)
		{
			if(used.find(i)==used.end())
			{
				bool poss=true;
				bool even=false;
				lli sz=m;
				if(sz%2==0)
					even=true;
				lli count=0;
				ss tr="";
				L(j,0,25)
				{
					L(k,1,(fre[i][j]+1)/2)
					{
						tr+=char('a'+j);
					}
					if(fre[i][j]%2!=0)
					{
						count++;
						if((even&&count)||((!even)&&(count>1)))
						{
							poss=false;
							break;
						}
					}
				}
				if(((!even)&&(count==0)))
					poss=false;
				if(poss)
				{
					//cout<<tr<<endl;
					ss s3=tr;
					reverse(s3.begin(),s3.end());
				//	cout<<tr<<" "<<s3<<endl;
					if(even)
						tr+=s3;
					else
						tr+=(s3.substr(1,m/2));
					pal.pb(tr);
					break;
				}
			}
		}

		ss ans;
		lli s2=con.size();
		L(i,0,s2-1)
		{
			L(j,0,m-1)
				ans+=ip[con[i]].at(j);
		}
		lli gap=0;
		if(pal.size()>0)
		{
			ans+=pal[0];
			gap=pal[0].length();
		}
		lli lr=ans.length();
		R(i,lr-gap-1,0)
			ans+=ans.at(i);
			cout<<ans.length()<<endl;
			cout<<ans<<endl;
	}
	//*/
	//cout<<ans<<endl;
//##########################################################
	return 0;
}


/*------------------------Original Copyright belongs to-------------------------/
!      																			!
!      ##  ##                                                		##  ##	    !
!      #   #             											#   #		!
!      				 ###  ####  ###   ###     ##         #                      !
!					#     #  #  #  #  #  #   #  #       ##                      !
!					#	  #  #  ###   ###    ####        #                      !
!					#     #  #  #  #  #  #   #  #        #                      !
!					 ###  ####  ###   #   #  #  #  ###  ### 			        !
!                                                                               !
/------------------------------------------------------------------------------*/
#include<bits/stdc++.h>
using namespace std;
//------------Template begins--------------------//
#define ss string
#define last(s) s.length()-1
#define lli long long int
#define ld long double
#define v(type) vector<type>
#define pr(type1,type2) pair<type1,type2>
#define ma(type1,type2) map<type1,type2>
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front
#define mp make_pair
#define L(i,start,end) for(lli i=start;i<=end;i++)
#define R(i,start,end) for(lli i=start;i>=end;i--)
#define inp(var,start,end,array) for(var=start;var<=end;var++) cin>>array[var];
#define whatIs(x) cout<<#x<<" is "<<x<<endl
#define dbg1D(i,start,end,arr) for(lli i=start;i<=end;i++) cout<<i<<"th : "<<arr[i]<<endl;
#define dbg2D(i,j,s1,e1,s2,e2,arr) for (lli i=s1;i<=e1;i++) {cout<<i<<"th :"; for(lli j=s2;j<=e2;j++)cout<<arr[i][j]<<" ";cout<<endl;}

lli dx[4]={-1, 0, 0, +1};
lli dy[4]={0, -1, +1, 0};
const lli LINF = 1e18;
const lli INF = 1e9;
const lli mod = 1e9+7;
lli power(lli a,lli b,lli m){ if(b==0) return 1; if(b==1) return a%m;
 		lli t=power(a,b/2,m); t=(t*t)%m; if(b&1) t=(t*a)%m; return t;}
lli modInverse(lli a, lli m) { return power(a, m-2, m); }
//---------------Template ends------------------//
lli n,m;
ss magic[26];
ss isP(ss s1)
{
	lli sz=s1.size();
	L(i,0,sz/2)
	{
		if(s1.at(i)!=s1.at(sz-1-i))
			return "";
	}
	return s1;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	#ifndef ONLINE_JUDGE
	freopen("ip.txt","r",stdin);
	freopen("op.txt","w",stdout);
	#endif
//#################### CATCH HERE ##########################
   	//* Uncomment if t test cases
	lli t=1;
	//cin>>t;
	L(i,0,25)
	{
		ss s1="";
		L(j,1,50)
			s1+=char('a'+i);
		magic[i]=s1;
	}
	while(t--)
	{
		lli i,j;
		cin>>n>>m;
		vector<ss> v1;
		L(i,1,n)
		{
			ss ip;
			cin>>ip;
			v1.pb(ip);
		}
		vector<ss> ans1;
		vector<ss> ans2;
		set<lli> used;
		L(i,0,n-1)
		{
			if(used.find(i)!=used.end())
				continue;
			L(j,i+1,n-1)
			{
				if(used.find(j)!=used.end())
					continue;
				ss tr=v1[j];
				reverse(tr.begin(),tr.end());
				if(v1[i]==tr)
				{
					used.insert(i);
					used.insert(j);
					ans1.pb(v1[i]);
					reverse(v1[i].begin(),v1[i].end());
					ans2.pb(v1[i]);
				}
			}
		}
		reverse(ans2.begin(),ans2.end());
		ss mid="";
		L(i,0,n-1)
		{
			if(used.find(i)==used.end())
			{
				ss le=isP(v1[i]);
				if(le!="")
				{
					mid=le;
					break;
				}
			}
		}
		ss ret="";
		lli l1,l2;
		l1=ans1.size();
		l2=ans2.size();
		L(i,0,l1-1)
			ret+=ans1[i];
		ret+=mid;
		L(i,0,l2-1)
			ret+=ans2[i];
		cout<<ret.size()<<endl;
		cout<<ret<<endl;
	}
	//*/
	//cout<<ans<<endl;
//##########################################################
	return 0;
}


/*------------------------Original Copyright belongs to-------------------------/
!      																			!
!      ##  ##                                                		##  ##	    !
!      #   #             											#   #		!
!      				 ###  ####  ###   ###     ##         #                      !
!					#     #  #  #  #  #  #   #  #       ##                      !
!					#	  #  #  ###   ###    ####        #                      !
!					#     #  #  #  #  #  #   #  #        #                      !
!					 ###  ####  ###   #   #  #  #  ###  ### 			        !
!                                                                               !
/------------------------------------------------------------------------------*/
#include<bits/stdc++.h>
using namespace std;
//------------Template begins--------------------//
#define ss string
#define last(s) s.length()-1
#define lli long long int
#define ld long double
#define v(type) vector<type>
#define pr(type1,type2) pair<type1,type2>
#define ma(type1,type2) map<type1,type2>
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front
#define mp make_pair
#define L(i,start,end) for(lli i=start;i<=end;i++)
#define R(i,start,end) for(lli i=start;i>=end;i--)
#define inp(var,start,end,array) for(var=start;var<=end;var++) cin>>array[var];
#define whatIs(x) cout<<#x<<" is "<<x<<endl
#define dbg1D(i,start,end,arr) for(lli i=start;i<=end;i++) cout<<i<<"th : "<<arr[i]<<endl;
#define dbg2D(i,j,s1,e1,s2,e2,arr) for (lli i=s1;i<=e1;i++) {cout<<i<<"th :"; for(lli j=s2;j<=e2;j++)cout<<arr[i][j]<<" ";cout<<endl;}

lli dx[4]={-1, 0, 0, +1};
lli dy[4]={0, -1, +1, 0};
const lli LINF = 1e18;
const lli INF = 1e9;
const lli mod = 1e9+7;
lli power(lli a,lli b,lli m){ if(b==0) return 1; if(b==1) return a%m;
 		lli t=power(a,b/2,m); t=(t*t)%m; if(b&1) t=(t*a)%m; return t;}
lli modInverse(lli a, lli m) { return power(a, m-2, m); }
//---------------Template ends------------------//
lli n,m;
ss magic[26];
ss isP(ss s1)
{
	char odd;
	lli count=0;
	map<char,lli> fr;
	lli sz=s1.length();
	ss ret="",deny="";
	L(i,0,sz-1)
		fr[s1.at(i)]++;
	L(i,0,25)
	{
		if(fr[i+'a']%2!=0)
		{
			count++;
			odd=i+'a';
		}
		ret+=magic[i].substr(0,fr[i+'a']/2);
	}
	ss temp=ret;
	reverse(temp.begin(),temp.end());
	if((m%2!=0)&&(count==1))
	{
		ret+=odd;
		ret+=temp;
		return ret;
	}
	else if(count==0)
	{
		ret+=temp;
		return ret;
	}
	else
		return deny;

}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	#ifndef ONLINE_JUDGE
	freopen("ip.txt","r",stdin);
	freopen("op.txt","w",stdout);
	#endif
//#################### CATCH HERE ##########################
   	//* Uncomment if t test cases
	lli t=1;
	//cin>>t;
	L(i,0,25)
	{
		ss s1="";
		L(j,1,50)
			s1+=char('a'+i);
		magic[i]=s1;
	}
	while(t--)
	{
		lli i,j;
		cin>>n>>m;
		vector<ss> v1;
		L(i,1,n)
		{
			ss ip;
			cin>>ip;
			sort(ip.begin(),ip.end());
			v1.pb(ip);
		}
		sort(all(v1));
		vector<ss> ans1;
		vector<ss> ans2;
		set<lli> used;
		L(i,0,n-2)
		{
			if(v1[i]==v1[i+1])
			{
				used.insert(i);
				used.insert(i+1);
				ans1.pb(v1[i]);
				reverse(v1[i].begin(),v1[i].end());
				ans2.pb(v1[i]);
				i++;
			}
		}
		reverse(ans2.begin(),ans2.end());
		ss mid="";
		L(i,0,n-1)
		{
			if(used.find(i)==used.end())
			{
				ss le=isP(v1[i]);
				if(le!="")
				{
					mid=le;
					break;
				}
			}
		}
		ss ret="";
		lli l1,l2;
		l1=ans1.size();
		l2=ans2.size();
		L(i,0,l1-1)
			ret+=ans1[i];
		ret+=mid;
		L(i,0,l2-1)
			ret+=ans2[i];
		cout<<ret.size()<<endl;
		cout<<ret<<endl;
	}
	//*/
	//cout<<ans<<endl;
//##########################################################
	return 0;
}


/*------------------------Original Copyright belongs to-------------------------/
!      																			!
!      ##  ##                                                		##  ##	    !
!      #   #             											#   #		!
!      				 ###  ####  ###   ###     ##         #                      !
!					#     #  #  #  #  #  #   #  #       ##                      !
!					#	  #  #  ###   ###    ####        #                      !
!					#     #  #  #  #  #  #   #  #        #                      !
!					 ###  ####  ###   #   #  #  #  ###  ### 			        !
!                                                                               !
/------------------------------------------------------------------------------*/
#include<bits/stdc++.h>
using namespace std;
//------------Template begins--------------------//
#define ss string
#define last(s) s.length()-1
#define lli long long int
#define ld long double
#define v(type) vector<type>
#define pr(type1,type2) pair<type1,type2>
#define ma(type1,type2) map<type1,type2>
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front
#define mp make_pair
#define L(i,start,end) for(lli i=start;i<=end;i++)
#define R(i,start,end) for(lli i=start;i>=end;i--)
#define inp(var,start,end,array) for(var=start;var<=end;var++) cin>>array[var];
#define whatIs(x) cout<<#x<<" is "<<x<<endl
#define dbg1D(i,start,end,arr) for(lli i=start;i<=end;i++) cout<<i<<"th : "<<arr[i]<<endl;
#define dbg2D(i,j,s1,e1,s2,e2,arr) for (lli i=s1;i<=e1;i++) {cout<<i<<"th :"; for(lli j=s2;j<=e2;j++)cout<<arr[i][j]<<" ";cout<<endl;}

lli dx[4]={-1, 0, 0, +1};
lli dy[4]={0, -1, +1, 0};
const lli LINF = 1e18;
const lli INF = 1e9;
const lli mod = 1e9+7;
lli power(lli a,lli b,lli m){ if(b==0) return 1; if(b==1) return a%m;
 		lli t=power(a,b/2,m); t=(t*t)%m; if(b&1) t=(t*a)%m; return t;}
lli modInverse(lli a, lli m) { return power(a, m-2, m); }
//---------------Template ends------------------//
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	#ifndef ONLINE_JUDGE
	freopen("ip.txt","r",stdin);
	freopen("op.txt","w",stdout);
	#endif
//#################### CATCH HERE ##########################
   	//* Uncomment if t test cases
	lli t;
	//cin>>t;
	t=1;
	while(t--)
	{
		lli n,m,i,j;
		cin>>n>>m;
		ss ip[n+1];
		lli fre[n+1][26]={0};
		set<lli> used;
		vector<lli> con;
		L(i,1,n)
		{
			cin>>ip[i];
			L(j,0,m-1)
				fre[i][ip[i].at(j)-'a']++;
		}
		L(i,1,n)
		{
			if(used.find(i)!=used.end())
				continue;
			L(j,i+1,n)
			{
				if(used.find(j)!=used.end())
					continue;
				bool poss=true;
				L(k,0,25)
				{
					if(fre[i][k]!=fre[j][k])
					{
						poss=false;
						break;
					}
				}
				if(poss)
				{
					used.insert(i);
					used.insert(j);
					con.pb(i);
				}
			}
		}
		vector<ss> pal;
		L(i,1,n)
		{
			if(used.find(i)==used.end())
			{
				bool poss=true;
				bool even=false;
				lli sz=m;
				if(sz%2==0)
					even=true;
				lli count=0;
				ss tr="";
				L(j,0,25)
				{
					L(k,1,(fre[i][j]+1)/2)
					{
						tr+=char('a'+j);
					}
					if(fre[i][j]%2!=0)
					{
						count++;
						if((even&&count)||((!even)&&(count>1)))
						{
							poss=false;
							break;
						}
					}
				}
				if(poss)
				{
					//cout<<tr<<endl;
					ss s3=tr;
					reverse(s3.begin(),s3.end());
				//	cout<<tr<<" "<<s3<<endl;
					if(even)
						tr+=s3;
					else
						tr+=(s3.substr(1,m/2));
					pal.pb(tr);
					break;
				}
			}
		}

		ss ans;
		lli s2=con.size();
		L(i,0,s2-1)
		{
			L(j,0,m-1)
				ans+=ip[con[i]].at(j);
		}
		lli gap=0;
		if(pal.size()>0)
		{
			ans+=pal[0];
			gap=pal[0].length();
		}
		lli lr=ans.length();
		R(i,lr-gap-1,0)
			ans+=ans.at(i);
			cout<<ans.length()<<endl;
			cout<<ans<<endl;
	}
	//*/
	//cout<<ans<<endl;
//##########################################################
	return 0;
}


/*------------------------Original Copyright belongs to-------------------------/
!      																			!
!      ##  ##                                                		##  ##	    !
!      #   #             											#   #		!
!      				 ###  ####  ###   ###     ##         #                      !
!					#     #  #  #  #  #  #   #  #       ##                      !
!					#	  #  #  ###   ###    ####        #                      !
!					#     #  #  #  #  #  #   #  #        #                      !
!					 ###  ####  ###   #   #  #  #  ###  ### 			        !
!                                                                               !
/------------------------------------------------------------------------------*/
#include<bits/stdc++.h>
using namespace std;
//------------Template begins--------------------//
#define ss string
#define last(s) s.length()-1
#define lli long long int
#define ld long double
#define v(type) vector<type>
#define pr(type1,type2) pair<type1,type2>
#define ma(type1,type2) map<type1,type2>
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front
#define mp make_pair
#define L(i,start,end) for(lli i=start;i<=end;i++)
#define R(i,start,end) for(lli i=start;i>=end;i--)
#define inp(var,start,end,array) for(var=start;var<=end;var++) cin>>array[var];
#define whatIs(x) cout<<#x<<" is "<<x<<endl
#define dbg1D(i,start,end,arr) for(lli i=start;i<=end;i++) cout<<i<<"th : "<<arr[i]<<endl;
#define dbg2D(i,j,s1,e1,s2,e2,arr) for (lli i=s1;i<=e1;i++) {cout<<i<<"th :"; for(lli j=s2;j<=e2;j++)cout<<arr[i][j]<<" ";cout<<endl;}

lli dx[4]={-1, 0, 0, +1};
lli dy[4]={0, -1, +1, 0};
const lli LINF = 1e18;
const lli INF = 1e9;
const lli mod = 1e9+7;
lli power(lli a,lli b,lli m){ if(b==0) return 1; if(b==1) return a%m;
 		lli t=power(a,b/2,m); t=(t*t)%m; if(b&1) t=(t*a)%m; return t;}
lli modInverse(lli a, lli m) { return power(a, m-2, m); }
//---------------Template ends------------------//
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	#ifndef ONLINE_JUDGE
	freopen("ip.txt","r",stdin);
	freopen("op.txt","w",stdout);
	#endif
//#################### CATCH HERE ##########################
   	//* Uncomment if t test cases
	lli t;
	//cin>>t;
	t=1;
	while(t--)
	{
		lli n,m,i,j;
		cin>>n>>m;
		ss ip[n+1];
		lli fre[n+1][26]={0};
		set<lli> used;
		vector<lli> con;
		L(i,1,n)
		{
			cin>>ip[i];
			L(j,0,m-1)
				fre[i][ip[i].at(j)-'a']++;
		}
		L(i,1,n)
		{
			if(used.find(i)!=used.end())
				continue;
			L(j,i+1,n)
			{
				if(used.find(j)!=used.end())
					continue;
				bool poss=true;
				L(k,0,25)
				{
					if(fre[i][k]!=fre[j][k])
					{
						poss=false;
						break;
					}
				}
				if(poss)
				{
					used.insert(i);
					used.insert(j);
					con.pb(i);
				}
			}
		}
		vector<ss> pal;
		L(i,1,n)
		{
			if(used.find(i)==used.end())
			{
				bool poss=true;
				bool even=false;
				lli sz=m;
				if(sz%2==0)
					even=true;
				lli count=0;
				ss tr="";
				L(j,0,25)
				{
					L(k,1,(fre[i][j]+1)/2)
					{
						tr+=char('a'+j);
					}
					if(fre[i][j]%2!=0)
					{
						count++;
						if((even&&count)||((!even)&&(count>1)))
						{
							poss=false;
							break;
						}
					}
				}
				if(poss)
				{
					//cout<<tr<<endl;
					ss s3=tr;
					reverse(s3.begin(),s3.end());
					if(even)
						tr+=s3;
					else
						tr+=(s3.substr(0,m/2));
					pal.pb(tr);
					break;
				}
			}
		}

		ss ans;
		lli s2=con.size();
		L(i,0,s2-1)
		{
			L(j,0,m-1)
				ans+=ip[con[i]].at(j);
		}
		lli gap=0;
		if(pal.size()>0)
		{
			ans+=pal[0];
			gap=pal[0].length();
		}
		lli lr=ans.length();
		R(i,lr-gap-1,0)
			ans+=ans.at(i);
			cout<<ans.length()<<endl;
			cout<<ans<<endl;
	}
	//*/
	//cout<<ans<<endl;
//##########################################################
	return 0;
}


/*------------------------Original Copyright belongs to-------------------------/
!      																			!
!      ##  ##                                                		##  ##	    !
!      #   #             											#   #		!
!      				 ###  ####  ###   ###     ##         #                      !
!					#     #  #  #  #  #  #   #  #       ##                      !
!					#	  #  #  ###   ###    ####        #                      !
!					#     #  #  #  #  #  #   #  #        #                      !
!					 ###  ####  ###   #   #  #  #  ###  ### 			        !
!                                                                               !
/------------------------------------------------------------------------------*/
#include<bits/stdc++.h>
using namespace std;
//------------Template begins--------------------//
#define ss string
#define last(s) s.length()-1
#define lli long long int
#define ld long double
#define v(type) vector<type>
#define pr(type1,type2) pair<type1,type2>
#define ma(type1,type2) map<type1,type2>
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front
#define mp make_pair
#define L(i,start,end) for(lli i=start;i<=end;i++)
#define R(i,start,end) for(lli i=start;i>=end;i--)
#define inp(var,start,end,array) for(var=start;var<=end;var++) cin>>array[var];
#define whatIs(x) cout<<#x<<" is "<<x<<endl
#define dbg1D(i,start,end,arr) for(lli i=start;i<=end;i++) cout<<i<<"th : "<<arr[i]<<endl;
#define dbg2D(i,j,s1,e1,s2,e2,arr) for (lli i=s1;i<=e1;i++) {cout<<i<<"th :"; for(lli j=s2;j<=e2;j++)cout<<arr[i][j]<<" ";cout<<endl;}

lli dx[4]={-1, 0, 0, +1};
lli dy[4]={0, -1, +1, 0};
const lli LINF = 1e18;
const lli INF = 1e9;
const lli mod = 1e9+7;
lli power(lli a,lli b,lli m){ if(b==0) return 1; if(b==1) return a%m;
 		lli t=power(a,b/2,m); t=(t*t)%m; if(b&1) t=(t*a)%m; return t;}
lli modInverse(lli a, lli m) { return power(a, m-2, m); }
//---------------Template ends------------------//
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	#ifndef ONLINE_JUDGE
	freopen("ip.txt","r",stdin);
	freopen("op.txt","w",stdout);
	#endif
//#################### CATCH HERE ##########################
   	//* Uncomment if t test cases
	lli t;
	//cin>>t;
	t=1;
	while(t--)
	{
		lli n,m,i,j;
		cin>>n>>m;
		ss ip[n+1];
		lli fre[n+1][26]={0};
		set<lli> used;
		vector<lli> con;
		L(i,1,n)
		{
			cin>>ip[i];
			L(j,0,m-1)
				fre[i][ip[i].at(j)-'a']++;
		}
		L(i,1,n)
		{
			if(used.find(i)!=used.end())
				continue;
			L(j,i+1,n)
			{
				if(used.find(j)!=used.end())
					continue;
				bool poss=true;
				L(k,0,25)
				{
					if(fre[i][k]!=fre[j][k])
					{
						poss=false;
						break;
					}
				}
				if(poss)
				{
					used.insert(i);
					used.insert(j);
					con.pb(i);
				}
			}
		}
		vector<ss> pal;
		L(i,1,n)
		{
			if(used.find(i)==used.end())
			{
				bool poss=true;
				bool even=false;
				lli sz=m;
				if(sz%2==0)
					even=true;
				lli count=0;
				ss tr="";
				L(j,0,25)
				{
					L(k,1,(fre[i][j]+1)/2)
					{
						tr+=char('a'+j-1);
					}
					if(fre[i][j]%2!=0)
					{
						count++;
						if((even&&count)||((!even)&&(count>1)))
						{
							poss=false;
							break;
						}
					}
				}
				if(poss)
				{
					if(even)
						tr+=tr;
					else
						tr+=(tr.substr(1,m/2));
					pal.pb(tr);
					break;
				}
			}
		}

		ss ans;
		lli s2=con.size();
		L(i,0,s2-1)
		{
			L(j,0,m-1)
				ans+=ip[con[i]].at(j);
		}
		lli gap=0;
		if(pal.size()>0)
		{
			ans+=pal[0];
			gap=pal[0].length();
		}
		lli lr=ans.length();
		R(i,lr-gap-1,0)
			ans+=ans.at(i);
			cout<<ans.length()<<endl;
			cout<<ans<<endl;
	}
	//*/
	//cout<<ans<<endl;
//##########################################################
	return 0;
}


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

int main()
{
	int n,m,flag=0,count=0;
	cin>>n>>m;
	int i,j,k,len;
	string str[n],string,string1,strk;
	int hash[n];
	for(i=0;i<n;i++)
	hash[i]=0;
	for(i=0;i<n;i++)
	{
		cin>>str[i];
	}
	for(i=0;i<n;i++)
	{
		flag=0;
		for(j=i+1;j<n;j++)
		{
			reverse(str[j].begin(),str[j].end());
			if(str[i]==str[j] && (hash[i]==0 && hash[j]==0))
			{
				string = string +str[i];
				hash[i]=1;
				hash[j]=1;
				flag=1;
			}
			reverse(str[j].begin(),str[j].end());
			if(flag==1)
				break;
		}
	}
	reverse(string.begin(),string.end());
	string1=string;
	reverse(string.begin(),string.end());
	len=len+2*string.length();
	int flag1=1;
	for(i=0;i<n;i++)
	{
	        if(hash[i]==0)
	        {
		    strk=str[i];
		    reverse(strk.begin(),strk.end());
		    if(strk==str[i])
		    {
		        string=string+str[i];
		        break;
		    }
	        }

	}

		string=string+string1;
		cout<<string.length()<<endl;
	cout<<string;
	return 0;
}


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

    int main()
    {
    	int n,m,flag=0,count=0;
    	cin>>n>>m;
    	int i,j,k,len;
    	string str[n],string,string1,strk;
    	int hash[n];
    	for(i=0;i<n;i++)
    	hash[i]=0;
    	for(i=0;i<n;i++)
    	{
    		cin>>str[i];
    	}
    	for(i=0;i<n;i++)
    	{
    		flag=0;
    		for(j=i+1;j<n;j++)
    		{
    			reverse(str[j].begin(),str[j].end());
    			if(str[i]==str[j])
    			{
    				string = string +str[i];

    				flag=1;
    			}
    			reverse(str[j].begin(),str[j].end());
    			if(flag==1)
    				break;
    		}
    	}
    	reverse(string.begin(),string.end());
    	string1=string;
    	reverse(string.begin(),string.end());
    	len=len+2*string.length();
    	int flag1=1;
    	for(i=0;i<n;i++)
    	{

    		    strk=str[i];
    		    reverse(strk.begin(),strk.end());
    		    if(strk==str[i])
    		    {
    		        string=string+str[i];
    		        break;
    		    }

    	}

    		string=string+string1;
    		cout<<string.length()<<endl;
    	cout<<string;
    	return 0;
    }


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

    int main()
    {
    	int n,m,flag=0,count=0;
    	cin>>n>>m;
    	int i,j,k,len;
    	string str[n],string,string1,strk;
    	int hash[n];
    	for(i=0;i<n;i++)
    	hash[i]=0;
    	for(i=0;i<n;i++)
    	{
    		cin>>str[i];
    	}
    	for(i=0;i<n;i++)
    	{
    		flag=0;
    		for(j=i+1;j<n;j++)
    		{
    			reverse(str[j].begin(),str[j].end());
    			if(str[i]==str[j] && (hash[i]==0 && hash[j]==0))
    			{
    				string = string +str[i];
    				hash[i]=1;
    				hash[j]=1;
    				flag=1;
    			}
    			reverse(str[j].begin(),str[j].end());
    			if(flag==1)
    				break;
    		}
    	}
    	reverse(string.begin(),string.end());
    	string1=string;
    	reverse(string.begin(),string.end());
    	len=len+2*string.length();
    	int flag1=1;
    	for(i=0;i<n;i++)
    	{

    		    strk=str[i];
    		    reverse(strk.begin(),strk.end());
    		    if(strk==str[i])
    		    {
    		        string=string+str[i];
    		        break;
    		    }

    	}

    		string=string+string1;
    		cout<<string.length()<<endl;
    	cout<<string;
    	return 0;
    }


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

int main()
{
	int n,m,flag=0,count=0,flag3=1;
	cin>>n>>m;
	int i,j,k,len;
	string str[n],string,string1;
	for(i=0;i<n;i++)
	{
		cin>>str[i];
	}
	for(i=0;i<n;i++)
	{
		flag=0;
		for(j=i+1;j<n;j++)
		{
			reverse(str[j].begin(),str[j].end());
			if(str[i]==str[j])
			{
				string = string +str[i];
				flag=1;
			}
			reverse(str[j].begin(),str[j].end());
			if(flag==1)
				break;
		}
	}

	reverse(string.begin(),string.end());
	string1=string;
	reverse(string.begin(),string.end());
	len=len+2*string.length();
	int flag1=1;
	for(i=0;i<n-1;i++)
	{
		flag=0;
		for(j=i+1;j<n;j++)
		{
			reverse(str[j].begin(),str[j].end());
			if(str[i]!=str[j])
			{
				int l = 0;
    				int h =str[i].length() - 1;

    				while (h > l)
    				{
        			if (str[i].at(l++) != str[i].at(h--))
        			{
        	  		  flag1=0;
        			}
    				}

			}
			if(flag1==1)
			{
			    int flag3=0;
				len=len+str[i].length();
				string=string+str[i];
				break;
			}

		}
		if(flag3==0)
		break;
	}
	int flag2=1;
	for(j=0;j<n-1;j++)
		{
			reverse(str[j].begin(),str[j].end());
			if(str[n-1]!=str[j])
			{
				int l = 0;
    				int h =str[n-1].length() - 1;
    // Keep comparing characters while they are same
    				while (h > l)
    				{
        			if (str[n-1].at(l++) != str[n-1].at(h--))
        			{
        	  		  flag2=0;
        			}
    				}

			}
			if(flag2==1)
			{
				len=len+str[n-1].length();
				string=string+str[n-1];
				break;
			}

		}
		string=string+string1;
		cout<<string.length()<<endl;
	cout<<string;
	return 0;
}


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

int main()
{
	int n,m,flag=0,count=0;
	cin>>n>>m;
	int i,j,k,len;
	string str[n],string,string1,strk;
	int hash[n];
	for(i=0;i<n;i++)
	hash[i]=0;
	for(i=0;i<n;i++)
	{
		cin>>str[i];
	}
	for(i=0;i<n;i++)
	{
		flag=0;
		for(j=i+1;j<n;j++)
		{
			reverse(str[j].begin(),str[j].end());
			if(str[i]==str[j] && (hash[i]==0 && hash[j]==0))
			{
				string = string +str[i];
				hash[i]=1;
				hash[j]=1;
				flag=1;
			}
			reverse(str[j].begin(),str[j].end());
			if(flag==1)
				break;
		}
	}
	reverse(string.begin(),string.end());
	string1=string;
	reverse(string.begin(),string.end());
	len=len+2*string.length();
	int flag1=1;
	for(i=0;i<n;i++)
	{
		if(hash[i]==0)
		{
		    strk=str[i];
		    reverse(strk.begin(),strk.end());
		    if(strk==str[i])
		    string=string+str[i];
		}
	}

		string=string+string1;
		cout<<string.length()<<endl;
	cout<<string;
	return 0;
}


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

int main()
{
	int n,m,flag=0,count=0;
	cin>>n>>m;
	int i,j,k,len;
	string str[n],string,string1,strk;
	int hash[n];
	for(i=0;i<n;i++)
	hash[i]=0;
	for(i=0;i<n;i++)
	{
		cin>>str[i];
	}
	for(i=0;i<n;i++)
	{
		flag=0;
		for(j=i+1;j<n;j++)
		{
			reverse(str[j].begin(),str[j].end());
			if(str[i]==str[j] && (hash[i]==0 && hash[j]==0))
			{
				string = string +str[i];
				hash[i]=1;
				hash[j]=1;
				flag=1;
			}
			reverse(str[j].begin(),str[j].end());
			if(flag==1)
				break;
		}
	}
	reverse(string.begin(),string.end());
	string1=string;
	reverse(string.begin(),string.end());
	len=len+2*string.length();
	int flag1=1;
	for(i=0;i<n;i++)
	{
		if(hash[i]==0)
		{
		    strk=str[i];
		    reverse(strk.begin(),strk.end());
		    if(strk==str[i])
		    string=string+str[i];
		    flag1=0;
		}
		if(flag1==0)
		break;
	}

		string=string+string1;
		cout<<string.length()<<endl;
	cout<<string;
	return 0;
}


#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define int long long
#define double long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define mod 1000000007
#define ceil(a,b) (a+b-1)/b
#define endl "\n"
 const int N=100005;
 const int inf=1e18;
 const double eps=1e-9;
int pow1(int a,int b){
    int res=1;
    while(b>0){
        if(b&1){
        	res=res*a;
		}
        a=a*a;
        b>>=1;
    }
    return res;
}

signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

	int n,m;
    cin>>n>>m;
    map<string,int>m1;
    string s[n];
    vector<string>ans;
    map<string,int>m2;
    for(int x=0;x<n;x++){
        cin>>s[x];
        m1[s[x]]++;
    }
    string mid;
    bool f=0;
    for(int x=0;x<n;x++){
        string s2=s[x];
        reverse(s2.begin(),s2.end());
        if(m1.count(s2)!=0&&s[x]!=s2){
            // auto itr=find(ans.begin(),ans.end(),s2);
            // auto itr1=find(ans.begin(),ans.end(),s[x]);
            if(m2.count(s2)==0&&m2.count(s[x])==0){
                for(int w=0;w<min(m1[s[x]],m1[s2]);w++){
                    ans.pb(s[x]);
                    m2[s[x]]++;
                }
            }
        }else{
            if(s[x]==s2&&m1[s[x]]==1){
                f=1;
                mid=s2;
            }else{
                // auto itr=find(ans.begin(),ans.end(),s2);
                if(s[x]==s2&&m1[s[x]]>1&&m2.count(s2)==0){
                    int r=m1[s2]/2;
                    m2[s2]=1;
                    if(m1[s2]%2==1){
                        f=1;
                        mid=s2;
                    }
                    for(int e=0;e<r;e++){
                        ans.pb(s2);
                    }
                }
            }
        }
    }
    int out=2*ans.size()*m;
    if(f==1){
        out+=m;
    }
        cout<<out<<endl;
        if(out==0){
            return 0;
        }
    for(int x=0;x<ans.size();x++){
        cout<<ans[x];
    }
    if(f==1){
    cout<<mid;}
    for(int x=ans.size()-1;x>=0;x--){
        string w1=ans[x];
        reverse(w1.begin(),w1.end());
        cout<<w1;
    }

return 0;
}


#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define int long long
#define double long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define mod 1000000007
#define ceil(a,b) (a+b-1)/b
#define endl "\n"
 const int N=100005;
 const int inf=1e18;
 const double eps=1e-9;
int pow1(int a,int b){
    int res=1;
    while(b>0){
        if(b&1){
        	res=res*a;
		}
        a=a*a;
        b>>=1;
    }
    return res;
}

signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

	int n,m;
    cin>>n>>m;
    map<string,int>m1;
    string s[n];
    deque<string>ans;
    map<string,int>m2;
    for(int x=0;x<n;x++){
        cin>>s[x];
        m1[s[x]]++;
    }
    string mid;
    bool f=0;
    for(int x=0;x<n;x++){
        string s2=s[x];
        reverse(s2.begin(),s2.end());
        if(m1.count(s2)!=0&&s[x]!=s2){
            // auto itr=find(ans.begin(),ans.end(),s2);
            // auto itr1=find(ans.begin(),ans.end(),s[x]);
            if(m2.count(s2)==0&&m2.count(s[x])==0){
                int ert=min(m1[s[x]],m1[s2]);
                for(int w=0;w<ert;w++){
                    ans.push_back(s[x]);
                    ans.push_front(s2);
                    m2[s[x]]++;
                    m2[s2]++;
                }
            }
        }else{
                // auto itr=find(ans.begin(),ans.end(),s2);
                if(s[x]==s2&&m2.count(s2)==0){
                    int r=m1[s2]/2;
                    m2[s2]=1;
                    if(m1[s2]%2==1){
                        f=1;
                        mid=s2;
                    }
                    for(int e=0;e<r;e++){
                        ans.push_back(s2);
                        ans.push_front(s2);
                    }
                }

        }
    }
    int out=m*ans.size();
    if(f==1){
        out+=m;
    }
        cout<<out<<endl;
        if(out==0){
            return 0;
        }
        int c=0;
        int r=ans.size();
        auto itr=ans.begin();
    for(itr;itr!=ans.end();itr++){
        c++;
        cout<<*itr;
        if(c==r/2){
            break;
        }
    }
    if(f==1){
        cout<<mid;
    }
    itr++;
    for(itr;itr!=ans.end();itr++){
        cout<<*itr;
    }

return 0;
}


#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define int long long
#define double long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define mod 1000000007
#define ceil(a,b) (a+b-1)/b
#define endl "\n"
 const int N=100005;
 const int inf=1e18;
 const double eps=1e-9;
int pow1(int a,int b){
    int res=1;
    while(b>0){
        if(b&1){
        	res=res*a;
		}
        a=a*a;
        b>>=1;
    }
    return res;
}

signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

	int n,m;
    cin>>n>>m;
    map<string,int>m1;
    string s[n];
    vector<string>ans;
    for(int x=0;x<n;x++){
        cin>>s[x];
        m1[s[x]]++;
    }
    string mid="";
    for(int x=0;x<n;x++){
        string s2=s[x];
        reverse(s2.begin(),s2.end());
        if(m1.count(s2)!=0&&s[x]!=s2){
            auto itr=find(ans.begin(),ans.end(),s2);
            auto itr1=find(ans.begin(),ans.end(),s[x]);
            if(itr==ans.end()&&itr1==ans.end()){
                for(int w=0;w<min(m1[s[x]],m1[s2]);w++){
                    ans.pb(s[x]);
                }
            }
        }else{
            if(s[x]==s2&&m1[s[x]]==1){
                mid=s2;
            }else{
                auto itr=find(ans.begin(),ans.end(),s2);
                if(s[x]==s2&&m1[s[x]]>1&&itr==ans.end()){
                    int r=m1[s2]/2;
                    if(m1[s2]%2==1){
                        mid=s2;
                    }
                    for(int e=0;e<r;e++){
                        ans.pb(s2);
                    }
                }
            }
        }
    }
    int out=2*ans.size()*m+mid.size();
        cout<<out<<endl;
        if(out==0){
            return 0;
        }
    for(int x=0;x<ans.size();x++){
        cout<<ans[x];
    }
    if(mid.size()!=0){
    cout<<mid;}
    for(int x=ans.size()-1;x>=0;x--){
        reverse(ans[x].begin(),ans[x].end());
        cout<<ans[x];
    }

return 0;
}


#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define int long long
#define double long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define mod 1000000007
#define ceil(a,b) (a+b-1)/b
#define endl "\n"
 const int N=100005;
 const int inf=1e18;
 const double eps=1e-9;
int pow1(int a,int b){
    int res=1;
    while(b>0){
        if(b&1){
        	res=res*a;
		}
        a=a*a;
        b>>=1;
    }
    return res;
}

signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

	int n,m;
    cin>>n>>m;
    map<string,int>m1;
    string s[n];
    vector<string>ans;
    for(int x=0;x<n;x++){
        cin>>s[x];
        m1[s[x]]++;
    }
    string mid="";
    for(int x=0;x<n;x++){
        string s2=s[x];
        reverse(s2.begin(),s2.end());
        if(m1.count(s2)!=0&&s[x]!=s2){
            auto itr=find(ans.begin(),ans.end(),s2);
            auto itr1=find(ans.begin(),ans.end(),s[x]);
            if(itr==ans.end()&&itr1==ans.end()){
                for(int w=0;w<min(m1[s[x]],m1[s2]);w++){
                    ans.pb(s[x]);
                }
            }
        }else{
            if(s[x]==s2&&m1[s[x]]==1){
                mid=s2;
            }else{
                auto itr=find(ans.begin(),ans.end(),s2);
                if(s[x]==s2&&m1[s[x]]>1&&itr==ans.end()){
                    int r=m1[s2]/2;
                    if(m1[s2]%2==1){
                        mid=s2;
                    }
                    for(int e=0;e<r;e++){
                        ans.pb(s2);
                    }
                }
            }
        }
    }
    int out=2*ans.size()*m+mid.size();
        cout<<out<<endl;
        if(out==0){
            return 0;
        }
    for(int x=0;x<ans.size();x++){
        cout<<ans[x];
    }
    cout<<mid;
    for(int x=ans.size()-1;x>=0;x--){
        reverse(ans[x].begin(),ans[x].end());
        cout<<ans[x];
    }

return 0;
}


#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define int long long
#define double long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define mod 1000000007
#define ceil(a,b) (a+b-1)/b
#define endl "\n"
 const int N=100005;
 const int inf=1e18;
 const double eps=1e-9;
int pow1(int a,int b){
    int res=1;
    while(b>0){
        if(b&1){
        	res=res*a;
		}
        a=a*a;
        b>>=1;
    }
    return res;
}

signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

	int n,m;
    cin>>n>>m;
    map<string,int>m1;
    string s[n];
    deque<string>ans;
    map<string,int>m2;
    for(int x=0;x<n;x++){
        cin>>s[x];
        m1[s[x]]++;
    }
    string mid;
    bool f=0;
    for(int x=0;x<n;x++){
        string s2=s[x];
        reverse(s2.begin(),s2.end());
        // cout<<s[x]<<" "<<s2;
        // return 0;
        if(m1.count(s2)!=0&&s[x]!=s2){
            // auto itr=find(ans.begin(),ans.end(),s2);
            // auto itr1=find(ans.begin(),ans.end(),s[x]);
            if(m2.count(s2)==0&&m2.count(s[x])==0){
                int ert=min(m1[s[x]],m1[s2]);
                for(int w=0;w<ert;w++){
                    ans.push_back(s[x]);
                    ans.push_front(s2);
                    m2[s[x]]++;
                    m2[s2]++;
                }
            }
        }else{
            // cout<<"F";
            // return 0;
                // auto itr=find(ans.begin(),ans.end(),s2);
                if(s[x]==s2&&m2.count(s2)==0){
                    // cout<<"F";
                    // return 0;
                    int r=m1[s2]/2;
                    m2[s2]=1;
                    if(m1[s2]%2==1){
                        f=1;
                        mid=s2;
                        // cout<<"f";
                        // return 0;
                    }
                    for(int e=0;e<r;e++){
                        ans.push_back(s2);
                        ans.push_front(s2);
                    }
                }

        }
    }
    int out=m*ans.size();
    if(f==1){
        out+=m;
    }
        cout<<out<<endl;
        // return 0;
        // if(out==0){
        //     return 0;
        // }
        int c=0;
        int r=ans.size();
        if(r!=0){
        auto itr=ans.begin();
    for(itr;itr!=ans.end();itr++){
        c++;
        cout<<*itr;
        if(c==r/2){
            break;
        }
    }
    if(f==1){
        cout<<mid;
    }
    itr++;
    for(itr;itr!=ans.end();itr++){
        cout<<*itr;
    }

}else{
    cout<<mid;
    return 0;
}

return 0;
}


#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define int long long
#define double long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define mod 1000000007
#define ceil(a,b) (a+b-1)/b
#define endl "\n"
 const int N=100005;
 const int inf=1e18;
 const double eps=1e-9;
int pow1(int a,int b){
    int res=1;
    while(b>0){
        if(b&1){
        	res=res*a;
		}
        a=a*a;
        b>>=1;
    }
    return res;
}

signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

	int n,m;
    cin>>n>>m;
    map<string,int>m1;
    string s[n];
    vector<string>ans;
    map<string,int>m2;
    for(int x=0;x<n;x++){
        cin>>s[x];
        m1[s[x]]++;
    }
    string mid="";
    for(int x=0;x<n;x++){
        string s2=s[x];
        reverse(s2.begin(),s2.end());
        if(m1.count(s2)!=0&&s[x]!=s2){
            // auto itr=find(ans.begin(),ans.end(),s2);
            // auto itr1=find(ans.begin(),ans.end(),s[x]);
            if(m2.count(s2)==0&&m2.count(s[x])==0){
                for(int w=0;w<min(m1[s[x]],m1[s2]);w++){
                    ans.pb(s[x]);
                    m2[s[x]]++;
                }
            }
        }else{
            if(s[x]==s2&&m1[s[x]]==1){
                mid=s2;
            }else{
                // auto itr=find(ans.begin(),ans.end(),s2);
                if(s[x]==s2&&m1[s[x]]>1&&m2.count(s2)==0){
                    int r=m1[s2]/2;
                    m2[s2]=1;
                    if(m1[s2]%2==1){
                        mid=s2;
                    }
                    for(int e=0;e<r;e++){
                        ans.pb(s2);
                    }
                }
            }
        }
    }
    int out=2*ans.size()*m+mid.size();
        cout<<out<<endl;
        if(out==0){
            return 0;
        }
    for(int x=0;x<ans.size();x++){
        cout<<ans[x];
    }
    if(mid.size()!=0){
    cout<<mid;}
    for(int x=ans.size()-1;x>=0;x--){
        reverse(ans[x].begin(),ans[x].end());
        cout<<ans[x];
    }

return 0;
}


#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define int long long
#define double long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define mod 1000000007
#define ceil(a,b) (a+b-1)/b
#define endl "\n"
 const int N=100005;
 const int inf=1e18;
 const double eps=1e-9;
int pow1(int a,int b){
    int res=1;
    while(b>0){
        if(b&1){
        	res=res*a;
		}
        a=a*a;
        b>>=1;
    }
    return res;
}
bool check(string str)
{
    // Start from leftmost and rightmost corners of str
    int l = 0;
    int h = str.length() - 1;

    // Keep comparing characters while they are same
    while (h > l)
    {
        if (str[l++] != str[h--])
        {
            return 0;
        }
    }
    return 1;
    // printf("%s is palindrome", str);
}
signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

	int n,m;
    cin>>n>>m;
    map<string,int>m1;
    string s[n];
    vector<string>ans;
    for(int x=0;x<n;x++){
        cin>>s[x];
        m1[s[x]]++;
    }
    string mid="";
    for(int x=0;x<n;x++){
        string s2=s[x];
        reverse(s2.begin(),s2.end());
        if(m1.count(s2)!=0&&s[x]!=s2){
            auto itr=find(ans.begin(),ans.end(),s2);
            auto itr1=find(ans.begin(),ans.end(),s[x]);
            if(itr==ans.end()&&itr1==ans.end()){
                for(int w=0;w<min(m1[s[x]],m1[s2]);w++){
                    ans.pb(s[x]);
                }
            }
        }else{
            if(s[x]==s2&&m1[s[x]]==1){
                if(s2.length()>mid.length()){
                    mid=s2;
                }
            }else{
                auto itr=find(ans.begin(),ans.end(),s2);
                if(s[x]==s2&&m1[s[x]]>1&&itr==ans.end()){
                    int r=m1[s2]/2;

                    for(int e=0;e<r;e++){
                        ans.pb(s2);
                    }
                }
            }
        }
    }
        cout<<(2*ans.size()*m+mid.size())<<endl;
    for(int x=0;x<ans.size();x++){
        cout<<ans[x];
    }

    cout<<mid;
    for(int x=ans.size()-1;x>=0;x--){
        reverse(ans[x].begin(),ans[x].end());
        cout<<ans[x];
    }

return 0;
}


#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define int long long
#define double long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define mod 1000000007
#define ceil(a,b) (a+b-1)/b
#define endl "\n"
 const int N=100005;
 const int inf=1e18;
 const double eps=1e-9;
int pow1(int a,int b){
    int res=1;
    while(b>0){
        if(b&1){
        	res=res*a;
		}
        a=a*a;
        b>>=1;
    }
    return res;
}

signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

	int n,m;
    cin>>n>>m;
    map<string,int>m1;
    string s[n];
    deque<string>ans;
    map<string,int>m2;
    for(int x=0;x<n;x++){
        cin>>s[x];
        m1[s[x]]++;
    }
    string mid;
    bool f=0;
    for(int x=0;x<n;x++){
        string s2=s[x];
        reverse(s2.begin(),s2.end());
        // cout<<s[x]<<" "<<s2;
        // return 0;
        if(m1.count(s2)!=0&&s[x]!=s2){
            // auto itr=find(ans.begin(),ans.end(),s2);
            // auto itr1=find(ans.begin(),ans.end(),s[x]);
            if(m2.count(s2)==0&&m2.count(s[x])==0){
                int ert=min(m1[s[x]],m1[s2]);
                for(int w=0;w<ert;w++){
                    ans.push_back(s[x]);
                    ans.push_front(s2);
                    m2[s[x]]++;
                    m2[s2]++;
                }
            }
        }else{
            // cout<<"F";
            // return 0;
                // auto itr=find(ans.begin(),ans.end(),s2);
                if(s[x]==s2&&m2.count(s2)==0){
                    // cout<<"F";
                    // return 0;
                    int r=m1[s2]/2;
                    m2[s2]=1;
                    if(m1[s2]%2==1){
                        f=1;
                        mid=s2;
                        // cout<<"f";
                        // return 0;
                    }
                    for(int e=0;e<r;e++){
                        ans.push_back(s2);
                        ans.push_front(s2);
                    }
                }

        }
    }
    int out=m*ans.size();
    if(f==1){
        out+=m;
    }
        cout<<out<<endl;
        // return 0;
        // if(out==0){
        //     return 0;
        // }
        int c=0;
        int r=ans.size();
        if(r!=0){
        auto itr=ans.begin();
    for(itr;itr!=ans.end();itr++){
        c++;
        cout<<*itr;
        if(c==r/2){
            break;
        }
    }

}else{
    cout<<mid;
    return 0;
}

return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define llu unsigned long long int
#define pb push_back
#define vi vector<int>
#define translow transform(s.begin(),s.end(),s.begin(),::tolower);
#define transup transform(s.begin(),s.end(),s.begin(),::toupper);
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll mod=1e9+7;

			ll check(string s)
			{
				string x=s;
				reverse(s.begin(),s.end());
				if(x==s)
				return 1;
				else
				return 0;
			}

int main() {
				fast
				ll n,m;
				cin>>n>>m;
				string arr[n];
				for(ll i=0;i<n;i++)
				{
					cin>>arr[i];

				}
				string ans="";

				for(ll i=0;i<n;i++)
				{
					string temp=arr[i];
					if(temp=="-1")
						continue;
					for(ll j=i+1;j<n;j++)
					{
						string ch=arr[j];
						if(ch=="-1")
						continue;
					    reverse(ch.begin(),ch.end());
					    if(temp==ch)
					    {
					    	ans+=temp;
							arr[j]="-1";
							arr[i]="-1";
							break;
						}
					}
				}
				string p1=ans;
				ll len=2*ans.size();
				string v="";
				for(ll i=0;i<n;i++)
				{
					if(arr[i]=="-1")
					continue;
					string h=arr[i];
					ll l1=0;
					if(check(h))
					{
						v+=arr[i];
						break;
					}

				}
				len+=v.size();
				cout<<len<<endl;
				cout<<p1<<v;
				reverse(ans.begin(),ans.end());
				cout<<ans;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define llu unsigned long long int
#define pb push_back
#define vi vector<int>
#define translow transform(s.begin(),s.end(),s.begin(),::tolower);
#define transup transform(s.begin(),s.end(),s.begin(),::toupper);
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll mod=1e9+7;

int main() {
				fast
				ll n,m;
				cin>>n>>m;
				string arr[n];
				map<string,ll>id;
				for(ll i=0;i<n;i++)
				{
					cin>>arr[i];
					id[arr[i]]++;
				}
				string ans="";

				for(ll i=0;i<n;i++)
				{
					string temp=arr[i];
					for(ll j=i+1;j<n;j++)
					{
						string ch=arr[j];
						ll count=0;
						ll start=0;
						if(ch=="-10")
						continue;
						for(ll k=ch.size()-1;k>=0;k--)
						{
								if(temp[start]==ch[k])
								count++;
								start++;
						}
						if(count==temp.size())
						{
							ans+=temp;
							arr[j]="-10";
							arr[i]="-10";
							break;
						}
					}
				}
				string p1=ans;
				ll len=2*ans.size();
				string v="";
				for(ll i=0;i<n;i++)
				{
					if(arr[i]=="-10")
					continue;
					string h=arr[i];
					ll l1=0;
					//cout<<h<<endl;
					for(ll j=0;j<h.size()/2;j++)
					{
						if(h[j]==h[h.size()-j-1])
						l1++;
					}
					if(l1==h.size()/2)
					{
						v+=arr[i];
						break;
					}
				//	v+=arr[i];
				}
				//cout<<v;
				len+=v.size();
				cout<<len<<endl;
				cout<<p1<<v;
				reverse(ans.begin(),ans.end());
				cout<<ans;
			//	cin>>s[i];

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define llu unsigned long long int
#define pb push_back
#define vi vector<int>
#define translow transform(s.begin(),s.end(),s.begin(),::tolower);
#define transup transform(s.begin(),s.end(),s.begin(),::toupper);
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll mod=1e9+7;

int main() {
				fast
				ll n,m;
				cin>>n>>m;
				string arr[n];
				map<string,ll>id;
				for(ll i=0;i<n;i++)
				{
					cin>>arr[i];
					id[arr[i]]++;
				}
				string ans="";

				for(ll i=0;i<n;i++)
				{
					string temp=arr[i];
					for(ll j=i+1;j<n;j++)
					{
						string ch=arr[j];
						ll count=0;
						ll start=0;
						for(ll k=ch.size()-1;k>=0;k--)
						{
								if(temp[start]==ch[k])
								count++;
								start++;
						}
						if(count==temp.size())
						{
							ans+=temp;
							arr[j]="-10";
							arr[i]="-10";
							break;
						}
					}
				}
				string p1=ans;
				ll len=2*ans.size();
				string v="";
				for(ll i=0;i<n;i++)
				{
					if(arr[i]=="-10")
					continue;
					string h=arr[i];
					ll l1=0;
					//cout<<h<<endl;
					for(ll j=0;j<h.size()/2;j++)
					{
						if(h[j]==h[h.size()-j-1])
						l1++;
					}
					if(l1==h.size()/2)
					{
						v+=arr[i];
						break;
					}
				//	v+=arr[i];
				}
				//cout<<v;
				len+=v.size();
				cout<<len<<endl;
				cout<<p1<<v;
				reverse(ans.begin(),ans.end());
				cout<<ans;
			//	cin>>s[i];

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define llu unsigned long long int
#define pb push_back
#define vi vector<int>
#define translow transform(s.begin(),s.end(),s.begin(),::tolower);
#define transup transform(s.begin(),s.end(),s.begin(),::toupper);
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll mod=1e9+7;

int main() {
				fast
				ll n,m;
				cin>>n>>m;
				string arr[n];
				map<string,ll>id;
				for(ll i=0;i<n;i++)
				{
					cin>>arr[i];
					id[arr[i]]++;
				}
				string ans="";

				for(ll i=0;i<n;i++)
				{
					string temp=arr[i];
					if(temp=="-10")
						continue;
					for(ll j=i+1;j<n;j++)
					{
						string ch=arr[j];
						ll count=0;
						ll start=0;
						if(ch=="-10")
						continue;
						for(ll k=ch.size()-1;k>=0;k--)
						{
								if(temp[start]==ch[k])
								count++;
								start++;
						}
						if(count==temp.size())
						{
							ans+=temp;
							arr[j]="-10";
							arr[i]="-10";
							break;
						}
					}
				}
				string p1=ans;
				ll len=2*ans.size();
				string v="";
				for(ll i=0;i<n;i++)
				{
					if(arr[i]=="-10")
					continue;
					string h=arr[i];
					ll l1=0;
					//cout<<h<<endl;
					for(ll j=0;j<h.size()/2;j++)
					{
						if(h[j]==h[h.size()-j-1])
						l1++;
					}
					if(l1==h.size()/2)
					{
						v+=arr[i];
						break;
					}
				//	v+=arr[i];
				}
				//cout<<v;
				len+=v.size();
				cout<<len<<endl;
				cout<<p1<<v;
				reverse(ans.begin(),ans.end());
				cout<<ans;
			//	cin>>s[i];

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define llu unsigned long long int
#define pb push_back
#define vi vector<int>
#define translow transform(s.begin(),s.end(),s.begin(),::tolower);
#define transup transform(s.begin(),s.end(),s.begin(),::toupper);
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll mod=1e9+7;

int main() {
				fast
				ll n,m;
				cin>>n>>m;
				string arr[n];
				map<string,ll>id;
				for(ll i=0;i<n;i++)
				{
					cin>>arr[i];
					id[arr[i]]++;
				}
				string ans="";

				for(ll i=0;i<n;i++)
				{
					string temp=arr[i];
					if(ch=="-10")
						continue;
					for(ll j=i+1;j<n;j++)
					{
						string ch=arr[j];
						ll count=0;
						ll start=0;
						if(ch=="-10")
						continue;
						for(ll k=ch.size()-1;k>=0;k--)
						{
								if(temp[start]==ch[k])
								count++;
								start++;
						}
						if(count==temp.size())
						{
							ans+=temp;
							arr[j]="-10";
							arr[i]="-10";
							break;
						}
					}
				}
				string p1=ans;
				ll len=2*ans.size();
				string v="";
				for(ll i=0;i<n;i++)
				{
					if(arr[i]=="-10")
					continue;
					string h=arr[i];
					ll l1=0;
					//cout<<h<<endl;
					for(ll j=0;j<h.size()/2;j++)
					{
						if(h[j]==h[h.size()-j-1])
						l1++;
					}
					if(l1==h.size()/2)
					{
						v+=arr[i];
						break;
					}
				//	v+=arr[i];
				}
				//cout<<v;
				len+=v.size();
				cout<<len<<endl;
				cout<<p1<<v;
				reverse(ans.begin(),ans.end());
				cout<<ans;
			//	cin>>s[i];

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define llu unsigned long long int
#define pb push_back
#define vi vector<int>
#define translow transform(s.begin(),s.end(),s.begin(),::tolower);
#define transup transform(s.begin(),s.end(),s.begin(),::toupper);
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll mod=1e9+7;

int main() {
				fast
				ll n,m;
				cin>>n>>m;
				string arr[n];
				map<string,ll>id;
				for(ll i=0;i<n;i++)
				{
					cin>>arr[i];
					id[arr[i]]++;
				}
				string ans="";

				for(ll i=0;i<n;i++)
				{
					string temp=arr[i];
					for(ll j=i+1;j<n;j++)
					{
						string ch=arr[j];
						ll count=0;
						ll start=0;
						for(ll k=ch.size()-1;k>=0;k--)
						{
								if(temp[start]==ch[k])
								count++;
								start++;
						}
						if(count==temp.size())
						{
							ans+=temp;
							arr[j]="-10";
							arr[i]="-10";
							break;
						}
					}
				}
				string p1=ans;
				ll len=2*ans.size();
				string v="";
				for(ll i=0;i<n;i++)
				{
					string h=arr[i];
					ll l1=0;
					//cout<<h<<endl;
					for(ll j=0;j<h.size()/2;j++)
					{
						if(h[j]==h[h.size()-j-1])
						l1++;
					}
					if(l1==h.size()/2)
					{
						v+=arr[i];
						break;
					}
				//	v+=arr[i];
				}
				//cout<<v;
				len+=v.size();
				cout<<len<<endl;
				cout<<p1<<v;
				reverse(ans.begin(),ans.end());
				cout<<ans;
			//	cin>>s[i];

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;typedef long double ld;typedef pair<int,int> pii;
#define F first
#define S second
#define PB push_back
#define MP make_pair
const ll mod = 1e9+7, M = 2e6+7, INF = INT_MAX/10;
ll powe(ll x, ll y){ x = x%mod, y=y%(mod-1);ll ans = 1;while(y>0){if (y&1){ans = (1ll * x * ans)%mod;}y>>=1;x = (1ll * x * x)%mod;}return ans;}
bool vis[105];

bool twin(string& a, string& b){
	for (int i = 0; i<a.size(); i++){
		if (a[i] != b[a.size()-1-i])
			return false;
	}
	return true;
}

bool palind(string& a){
	return twin(a,a);
}

int main(){
    fast;
    string ans="", temp;
    int n, m;
    cin >> n >> m;
    vector<string> inp(n);
    for (int i = 0; i<n; i++){
    	cin >> inp[i];
    }
    vector<string> twin1, twin2;
    for (int i = 0; i<n; i++){
    	if (vis[i])
    		continue;
    	for (int j = i+1; j<n; j++){
    		if (vis[i])
    			continue;
    		if (twin(inp[i], inp[j])){
    			vis[j] = vis[i] = true;
    			twin1.PB(inp[i]);
    			twin2.PB(inp[j]);
    		}
    	}
    }
    for (int i = 0; i<n; i++){
    	if (!vis[i] && palind(inp[i])){
    		ans = inp[i];
    		break;
    	}
    }
    for (int i = 0; i<twin1.size(); i++){
    	ans = twin1[i] + ans + twin2[i];
    }
    cout << ans.size() << "\n";
    cout << ans;
    return 0;
}


#include <bits/stdc++.h>
//   #include <ext/pb_ds/assoc_container.hpp>

//   using namespace __gnu_pbds;
using namespace std;

typedef unsigned long long int ull;
typedef long double ldb;
typedef long long int ll;

#define for01(k,n)      for (ll i=k; i<n; i++)
#define for02(k,n)      for (ll j=k; j<n; j++)
#define for03(k,n)      for (ll k=k; k<n; k++)
#define for11(k,n)      for (ll i=k; i<=n; i++)
#define for12(k,n)      for (ll j=k; j<=n; j++)
#define for13(k,n)      for (ll k=k; k<=n; k++)
#define forIT(c,it)     for(typeof(c.begin()) it = c.begin(); it != c.end(); ++it)

// 2-Way iteration possible
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define pb      push_back
#define mp      make_pair

#define pf      push_front
#define popf        pop_front
#define popb        pop_back

#define vll     vector<ll>
#define vint        vector<int>
#define mll     map<ll,ll>
#define mint        map<int,int>

#define mll_it      map<ll,ll>::iterator
#define mint_it     map<int,int>::iterator

#define all(c)      c.begin(), c.end()

#define F       first
#define S       second
#define pp      pair <ll, ll>

#define lb      lower_bound
#define ub      upper_bound

#define emp     empty()
#define beg     begin()
#define en      end()
#define si      size()
#define bk      back()

#define present(c,el)   (c.find(el) != c.end())     // For containers with member function ‘find()’ (i.e. set/map, etc.)
#define cpresent(c,el)  (find(all(c),el) != c.end())    // For vectors

#define deci(n)     fixed<<setprecision(n)

#define p0(a)       cout << a << " "
#define p1(a)       cout << a << "\n"

#define mem(a,n)    memset(a, n, sizeof(a)); // n = 0 OR -1 only

#define MAX     LLONG_MAX
#define MIN     LLONG_MIN
#define MOD1        1000000007
#define MOD2        998244353
#define val1    1e6
#define BOOST       ios_base::sync_with_stdio(false); cin.tie(NULL)
int h=100000+7;
 ll n,m;
int pal(string x,string y)
{
  for(int i=0;i<m;i++)
  {
    if(x[i]!=y[m-i-1])return -1;
  }return 1;
}
int spal(string x)
{
  for (int i = 0; i < m/2; ++i)
  {
    if(x[i]!=x[m-i-1])return -1;
  }return 1;
}
int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  #ifndef ONLINE_JUDGE
  // for getting input from input.txt
  freopen("input.txt", "r", stdin);
  // for writing output to output.txt
  freopen("output.txt", "w", stdout);
  #endif
  cin>>n>>m;
  vector <string >v;
  string ar[n];
  ll cc[n]={0};
  int y=-1;
  for01(0,n)cin>>ar[i];

  for01(0,n)
  {
    for02(i+1,n)
    {
      if(cc[j]==0 and cc[i]==0)
      {
        if(pal(ar[i],ar[j])==1)
          {
            v.pb(ar[i]);v.pb(ar[j]);cc[i]=1;cc[j]=1;
            break;
          }

      }
    }
    if(spal(ar[i])==1 and cc[i]==0)y=i;
  }

  ll sz=v.size();

  string are[sz/2];
  string aro[sz/2];
  int e=0,o=0;

  for01(0,sz)
  {
    if(i%2==0){are[e]=v[i];e++;}
    else{aro[o]=v[i];o++;}
  }
  ll len=sz;
  len*=m;
  if(y!=-1 and cc[y]==0)len+=m;
  cout<<len<<endl;
  string ans="";
  if(y!=-1 and cc[y]==0)ans=ar[y];
  for01(0,sz/2)
  ans=are[i]+ans+aro[i];
  cout<<ans;
}


#include <bits/stdc++.h>
//   #include <ext/pb_ds/assoc_container.hpp>

//   using namespace __gnu_pbds;
using namespace std;

typedef unsigned long long int ull;
typedef long double ldb;
typedef long long int ll;

#define for01(k,n)      for (ll i=k; i<n; i++)
#define for02(k,n)      for (ll j=k; j<n; j++)
#define for03(k,n)      for (ll k=k; k<n; k++)
#define for11(k,n)      for (ll i=k; i<=n; i++)
#define for12(k,n)      for (ll j=k; j<=n; j++)
#define for13(k,n)      for (ll k=k; k<=n; k++)
#define forIT(c,it)     for(typeof(c.begin()) it = c.begin(); it != c.end(); ++it)

// 2-Way iteration possible
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define pb      push_back
#define mp      make_pair

#define pf      push_front
#define popf        pop_front
#define popb        pop_back

#define vll     vector<ll>
#define vint        vector<int>
#define mll     map<ll,ll>
#define mint        map<int,int>

#define mll_it      map<ll,ll>::iterator
#define mint_it     map<int,int>::iterator

#define all(c)      c.begin(), c.end()

#define F       first
#define S       second
#define pp      pair <ll, ll>

#define lb      lower_bound
#define ub      upper_bound

#define emp     empty()
#define beg     begin()
#define en      end()
#define si      size()
#define bk      back()

#define present(c,el)   (c.find(el) != c.end())     // For containers with member function ‘find()’ (i.e. set/map, etc.)
#define cpresent(c,el)  (find(all(c),el) != c.end())    // For vectors

#define deci(n)     fixed<<setprecision(n)

#define p0(a)       cout << a << " "
#define p1(a)       cout << a << "\n"

#define mem(a,n)    memset(a, n, sizeof(a)); // n = 0 OR -1 only

#define MAX     LLONG_MAX
#define MIN     LLONG_MIN
#define MOD1        1000000007
#define MOD2        998244353
#define val1    1e6
#define BOOST       ios_base::sync_with_stdio(false); cin.tie(NULL)
int h=100000+7;
 ll n,m;
int pal(string x,string y)
{
  for(int i=0;i<m;i++)
  {
    if(x[i]!=y[m-i-1])return -1;
  }return 1;
}
int spal(string x)
{
  for (int i = 0; i < m/2; ++i)
  {
    if(x[i]!=x[m-i-1])return -1;
  }return 1;
}
int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  #ifndef ONLINE_JUDGE
  // for getting input from input.txt
  freopen("input.txt", "r", stdin);
  // for writing output to output.txt
  freopen("output.txt", "w", stdout);
  #endif
  cin>>n>>m;
  vector <string >v;
  string ar[n];
  ll cc[n]={0};
  int y=-1;
  for01(0,n)cin>>ar[i];
 // for01(0,n)cout<<ar[i];
  for01(0,n)
  {//cout<<"d";
    for02(i+1,n)
    {
      if(cc[j]==0 and cc[i]==0)
      {
        if(pal(ar[i],ar[j])==1)
          {
            v.pb(ar[i]);v.pb(ar[j]);cc[i]=1;cc[j]=1;
            break;
          }

      }
    }
    if(spal(ar[i])==1 and cc[i]==0)y=i;
  }

  ll sz=v.size();

  string are[sz/2];
  string aro[sz/2];
  int e=0,o=0;

  for01(0,sz)
  {
    if(i%2==0){are[e]=v[i];e++;}
    else{aro[o]=v[i];o++;}
  }
  ll len=sz;
  len*=m;
  if(y!=-1 and cc[y]==0)len+=m;
  cout<<len<<endl;
  for01(0,sz/2)
  cout<<are[i];
  if(cc[y]==0)cout<<ar[y];
  for01(0,sz/2)
  cout<<aro[(sz/2)-i-1];
}


#include <bits/stdc++.h>
//   #include <ext/pb_ds/assoc_container.hpp>

//   using namespace __gnu_pbds;
using namespace std;

typedef unsigned long long int ull;
typedef long double ldb;
typedef long long int ll;

#define for01(k,n)      for (ll i=k; i<n; i++)
#define for02(k,n)      for (ll j=k; j<n; j++)
#define for03(k,n)      for (ll k=k; k<n; k++)
#define for11(k,n)      for (ll i=k; i<=n; i++)
#define for12(k,n)      for (ll j=k; j<=n; j++)
#define for13(k,n)      for (ll k=k; k<=n; k++)
#define forIT(c,it)     for(typeof(c.begin()) it = c.begin(); it != c.end(); ++it)

// 2-Way iteration possible
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define pb      push_back
#define mp      make_pair

#define pf      push_front
#define popf        pop_front
#define popb        pop_back

#define vll     vector<ll>
#define vint        vector<int>
#define mll     map<ll,ll>
#define mint        map<int,int>

#define mll_it      map<ll,ll>::iterator
#define mint_it     map<int,int>::iterator

#define all(c)      c.begin(), c.end()

#define F       first
#define S       second
#define pp      pair <ll, ll>

#define lb      lower_bound
#define ub      upper_bound

#define emp     empty()
#define beg     begin()
#define en      end()
#define si      size()
#define bk      back()

#define present(c,el)   (c.find(el) != c.end())     // For containers with member function ‘find()’ (i.e. set/map, etc.)
#define cpresent(c,el)  (find(all(c),el) != c.end())    // For vectors

#define deci(n)     fixed<<setprecision(n)

#define p0(a)       cout << a << " "
#define p1(a)       cout << a << "\n"

#define mem(a,n)    memset(a, n, sizeof(a)); // n = 0 OR -1 only

#define MAX     LLONG_MAX
#define MIN     LLONG_MIN
#define MOD1        1000000007
#define MOD2        998244353
#define val1    1e6
#define BOOST       ios_base::sync_with_stdio(false); cin.tie(NULL)
int h=100000+7;
 ll n,m;
int pal(string x,string y)
{
  for(int i=0;i<m;i++)
  {
    if(x[i]!=y[m-i-1])return -1;
  }return 1;
}
int spal(string x)
{
  for (int i = 0; i < m/2; ++i)
  {
    if(x[i]!=x[m-i-1])return -1;
  }return 1;
}
int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  #ifndef ONLINE_JUDGE
  // for getting input from input.txt
  freopen("input.txt", "r", stdin);
  // for writing output to output.txt
  freopen("output.txt", "w", stdout);
  #endif
  cin>>n>>m;
  vector <string >v;
  string ar[n];
  ll cc[n]={0};
  int y=-1;
  for01(0,n)cin>>ar[i];

  for01(0,n)
  {
    for02(i+1,n)
    {
      if(cc[j]==0 and cc[i]==0)
      {
        if(pal(ar[i],ar[j])==1)
          {
            v.pb(ar[i]);v.pb(ar[j]);cc[i]=1;cc[j]=1;
            break;
          }

      }
    }
    if(spal(ar[i])==1 and cc[i]==0)y=i;
  }

  ll sz=v.size();

  string are[sz/2];
  string aro[sz/2];
  int e=0,o=0;

  for01(0,sz)
  {
    if(i%2==0){are[e]=v[i];e++;}
    else{aro[o]=v[i];o++;}
  }
  ll len=sz;
  len*=m;
  if(y!=-1 and cc[y]==0)len+=m;
  cout<<len<<endl;
  string ans="";
  if(cc[y]==0)ans=ar[y];
  for01(0,sz/2)
  ans=are[i]+ans+aro[i];
  cout<<ans;
}


#include <bits/stdc++.h>
//   #include <ext/pb_ds/assoc_container.hpp>

//   using namespace __gnu_pbds;
using namespace std;

typedef unsigned long long int ull;
typedef long double ldb;
typedef long long int ll;

#define for01(k,n)      for (ll i=k; i<n; i++)
#define for02(k,n)      for (ll j=k; j<n; j++)
#define for03(k,n)      for (ll k=k; k<n; k++)
#define for11(k,n)      for (ll i=k; i<=n; i++)
#define for12(k,n)      for (ll j=k; j<=n; j++)
#define for13(k,n)      for (ll k=k; k<=n; k++)
#define forIT(c,it)     for(typeof(c.begin()) it = c.begin(); it != c.end(); ++it)

// 2-Way iteration possible
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define pb      push_back
#define mp      make_pair

#define pf      push_front
#define popf        pop_front
#define popb        pop_back

#define vll     vector<ll>
#define vint        vector<int>
#define mll     map<ll,ll>
#define mint        map<int,int>

#define mll_it      map<ll,ll>::iterator
#define mint_it     map<int,int>::iterator

#define all(c)      c.begin(), c.end()

#define F       first
#define S       second
#define pp      pair <ll, ll>

#define lb      lower_bound
#define ub      upper_bound

#define emp     empty()
#define beg     begin()
#define en      end()
#define si      size()
#define bk      back()

#define present(c,el)   (c.find(el) != c.end())     // For containers with member function ‘find()’ (i.e. set/map, etc.)
#define cpresent(c,el)  (find(all(c),el) != c.end())    // For vectors

#define deci(n)     fixed<<setprecision(n)

#define p0(a)       cout << a << " "
#define p1(a)       cout << a << "\n"

#define mem(a,n)    memset(a, n, sizeof(a)); // n = 0 OR -1 only

#define MAX     LLONG_MAX
#define MIN     LLONG_MIN
#define MOD1        1000000007
#define MOD2        998244353
#define val1    1e6
#define BOOST       ios_base::sync_with_stdio(false); cin.tie(NULL)
int h=100000+7;
 ll n,m;
int pal(string x,string y)
{
  for(int i=0;i<m;i++)
  {
    if(x[i]!=y[m-i-1])return -1;
  }return 1;
}
int spal(string x)
{
  for (int i = 0; i < m/2; ++i)
  {
    if(x[i]!=x[m-i-1])return -1;
  }return 1;
}
int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  #ifndef ONLINE_JUDGE
  // for getting input from input.txt
  freopen("input.txt", "r", stdin);
  // for writing output to output.txt
  freopen("output.txt", "w", stdout);
  #endif
  cin>>n>>m;
  vector <string >v;
  string ar[n];
  ll cc[n]={0};
  int y=-1;
  for01(0,n)cin>>ar[i];
 // for01(0,n)cout<<ar[i];
  for01(0,n)
  {//cout<<"d";
    for02(i+1,n)
    {
      if(cc[j]==0 and cc[i]==0)
      {
        if(pal(ar[i],ar[j])==1)
          {
            v.pb(ar[i]);v.pb(ar[j]);cc[i]=1;cc[j]=1;
            break;
          }

      }
    }
    if(spal(ar[i])==1 and cc[i]==0)y=i;
  }

  ll sz=v.size();

  string are[sz/2];
  string aro[sz/2];
  int e=0,o=0;

  for01(0,sz)
  {
    if(i%2==0){are[e]=v[i];e++;}
    else{aro[o]=v[i];o++;}
  }
  ll len=sz;
  len*=m;
  if(y!=-1 and cc[y]==0)len+=m;
  cout<<len<<endl;
  for01(0,sz/2)
  cout<<are[i];
  if(cc[y]==0)cout<<ar[y];
  for01(0,sz/2)
  cout<<aro[i];

}


#include <bits/stdc++.h>
//   #include <ext/pb_ds/assoc_container.hpp>

//   using namespace __gnu_pbds;
using namespace std;

typedef unsigned long long int ull;
typedef long double ldb;
typedef long long int ll;

#define for01(k,n)      for (ll i=k; i<n; i++)
#define for02(k,n)      for (ll j=k; j<n; j++)
#define for03(k,n)      for (ll k=k; k<n; k++)
#define for11(k,n)      for (ll i=k; i<=n; i++)
#define for12(k,n)      for (ll j=k; j<=n; j++)
#define for13(k,n)      for (ll k=k; k<=n; k++)
#define forIT(c,it)     for(typeof(c.begin()) it = c.begin(); it != c.end(); ++it)

// 2-Way iteration possible
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define pb      push_back
#define mp      make_pair

#define pf      push_front
#define popf        pop_front
#define popb        pop_back

#define vll     vector<ll>
#define vint        vector<int>
#define mll     map<ll,ll>
#define mint        map<int,int>

#define mll_it      map<ll,ll>::iterator
#define mint_it     map<int,int>::iterator

#define all(c)      c.begin(), c.end()

#define F       first
#define S       second
#define pp      pair <ll, ll>

#define lb      lower_bound
#define ub      upper_bound

#define emp     empty()
#define beg     begin()
#define en      end()
#define si      size()
#define bk      back()

#define present(c,el)   (c.find(el) != c.end())     // For containers with member function ‘find()’ (i.e. set/map, etc.)
#define cpresent(c,el)  (find(all(c),el) != c.end())    // For vectors

#define deci(n)     fixed<<setprecision(n)

#define p0(a)       cout << a << " "
#define p1(a)       cout << a << "\n"

#define mem(a,n)    memset(a, n, sizeof(a)); // n = 0 OR -1 only

#define MAX     LLONG_MAX
#define MIN     LLONG_MIN
#define MOD1        1000000007
#define MOD2        998244353
#define val1    1e6
#define BOOST       ios_base::sync_with_stdio(false); cin.tie(NULL)
int h=100000+7;
 ll n,m;
int pal(string x,string y)
{
  for(int i=0;i<m;i++)
  {
    if(x[i]!=y[m-i-1])return -1;
  }return 1;
}
int spal(string x)
{
  for (int i = 0; i < m/2; ++i)
  {
    if(x[i]!=x[m-i-1])return -1;
  }return 1;
}
int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  #ifndef ONLINE_JUDGE
  // for getting input from input.txt
  freopen("input.txt", "r", stdin);
  // for writing output to output.txt
  freopen("output.txt", "w", stdout);
  #endif
  cin>>n>>m;
  vector <string >v;
  string ar[n];
  ll cc[n]={0};
  int y=-1;
  for01(0,n)cin>>ar[i];

  for01(0,n)
  {//cout<<"d";
    for02(i+1,n)
    {
      if(cc[j]==0 and cc[i]==0)
      {
        if(pal(ar[i],ar[j])==1)
          {
            v.pb(ar[i]);v.pb(ar[j]);cc[i]=1;cc[j]=1;
            break;
          }

      }
    }
    if(spal(ar[i])==1 and cc[i]==0)y=i;
  }

  ll sz=v.size();

  string are[sz/2];
  string aro[sz/2];
  int e=0,o=0;

  for01(0,sz)
  {
    if(i%2==0){are[e]=v[i];e++;}
    else{aro[o]=v[i];o++;}
  }
  ll len=sz;
  len*=m;
  if(y!=-1 and cc[y]==0)len+=m;
  cout<<len<<endl;
  for01(0,sz/2)
  cout<<are[i];
  if(cc[y]==0)cout<<ar[y];
  for01(0,sz/2)
  cout<<aro[(sz/2)-i-1];
}


#include <bits/stdc++.h>
//   #include <ext/pb_ds/assoc_container.hpp>

//   using namespace __gnu_pbds;
using namespace std;

typedef unsigned long long int ull;
typedef long double ldb;
typedef long long int ll;

#define for01(k,n)      for (ll i=k; i<n; i++)
#define for02(k,n)      for (ll j=k; j<n; j++)
#define for03(k,n)      for (ll k=k; k<n; k++)
#define for11(k,n)      for (ll i=k; i<=n; i++)
#define for12(k,n)      for (ll j=k; j<=n; j++)
#define for13(k,n)      for (ll k=k; k<=n; k++)
#define forIT(c,it)     for(typeof(c.begin()) it = c.begin(); it != c.end(); ++it)

// 2-Way iteration possible
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define pb      push_back
#define mp      make_pair

#define pf      push_front
#define popf        pop_front
#define popb        pop_back

#define vll     vector<ll>
#define vint        vector<int>
#define mll     map<ll,ll>
#define mint        map<int,int>

#define mll_it      map<ll,ll>::iterator
#define mint_it     map<int,int>::iterator

#define all(c)      c.begin(), c.end()

#define F       first
#define S       second
#define pp      pair <ll, ll>

#define lb      lower_bound
#define ub      upper_bound

#define emp     empty()
#define beg     begin()
#define en      end()
#define si      size()
#define bk      back()

#define present(c,el)   (c.find(el) != c.end())     // For containers with member function ‘find()’ (i.e. set/map, etc.)
#define cpresent(c,el)  (find(all(c),el) != c.end())    // For vectors

#define deci(n)     fixed<<setprecision(n)

#define p0(a)       cout << a << " "
#define p1(a)       cout << a << "\n"

#define mem(a,n)    memset(a, n, sizeof(a)); // n = 0 OR -1 only

#define MAX     LLONG_MAX
#define MIN     LLONG_MIN
#define MOD1        1000000007
#define MOD2        998244353
#define val1    1e6
#define BOOST       ios_base::sync_with_stdio(false); cin.tie(NULL)
int h=100000+7;
 ll n,m;
int pal(string x,string y)
{
  for(int i=0;i<m;i++)
  {
    if(x[i]!=y[m-i-1])return -1;
  }return 1;
}
int spal(string x)
{
  for (int i = 0; i < m/2; ++i)
  {
    if(x[i]!=x[m-i-1])return -1;
  }return 1;
}
int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  #ifndef ONLINE_JUDGE
  // for getting input from input.txt
  freopen("input.txt", "r", stdin);
  // for writing output to output.txt
  freopen("output.txt", "w", stdout);
  #endif
  cin>>n>>m;
  vector <string >v;
  string ar[n];
  ll cc[n]={0};
  int y=-1;
  for01(0,n)cin>>ar[i];
 // for01(0,n)cout<<ar[i];
  for01(0,n)
  {//cout<<"d";
    for02(i+1,n)
    {
      if(cc[j]==0 and cc[i]==0)
      {
        if(pal(ar[i],ar[j])==1)
          {
            v.pb(ar[i]);v.pb(ar[j]);cc[i]=1;cc[j]=1;
            break;
          }

      }
    }
    if(spal(ar[i])==1 and cc[i]==0)y=i;
  }

  ll sz=v.size();

  string are[sz/2];
  string aro[sz/2];
  int e=0,o=0;

  for01(0,sz)
  {
    if(i%2==0){are[e]=v[i];e++;}
    else{aro[o]=v[i];o++;}
  }
  ll len=sz;
  len*=m;
  if(y!=-1 and cc[y]==0)len+=m;
  cout<<len<<endl;
  for01(0,sz/2)
  cout<<are[i];
  if(cc[y]==0)cout<<ar[y];
  for01(0,sz/2)
  cout<<are[(sz/2)-i-1];
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//code here;
//	ll t; cin>>t;
//	while(t--) {
		ll n,m,i,j,k; cin>>n>>m;
		vector<string> v(n);
		string s;
		s+="0";
		vector<pair<string,string> > p;
		for(ll i=0;i<n;i++) cin>>v[i];
		for(i=0;i<n;i++) {
			for(j=i+1;j<n;j++) if(v[i][0]==v[j][m-1]) {
				ll k;
				for(k=0;k<m;k++) if(v[i][k]!=v[j][m-1-k]) break;
				if(k==m) {
					p.push_back(make_pair(v[i],v[j]));
					break;
				}
			}
			if(j==n) {
				for(j=0;j<n/2;j++) if(v[i][j]!=v[i][m-1-j]) break;
				if(j==n/2) s=v[i];
			}
		}
		if(p.size()==0 && s[0]=='0') {
			cout<<"0"<<endl;
			return 0;
		}
		if(s[0]!='0') cout<<2*p.size()*m+m<<endl;
		else cout<<2*p.size()*m<<endl;
		for(i=0;i<p.size();i++) cout<<p[i].first;
		if(s[0]!='0') cout<<s;
		for(i=p.size()-1;i>=0;i--) cout<<p[i].second;
//	}
	return 0;
}