#include <iostream>
#include <cstdio>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
const int N = 1e5 + 10;

int n, m;
int ff[110][3];
vector<string> S, D;
int main() {
	scanf("%d %d", &n, &m);
	getchar();
	for (int i = 0; i < n; i++) {
		string s, d;
		cin >> s;
		S.push_back(s);
		reverse(s.begin(), s.end());
		D.push_back(s);
	}
	int ans = 0, cnt = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i; j < n; j++) {
			if (S[i]==D[j]) {
				if (i == j) {
					ff[ans][0] = i;
					ff[ans][2] = 1;
					cnt++;
					ans++;
				}
				else {
					ff[ans][0] = i, ff[ans][1] = j;
					ans++;
				}
				break;
			}
		}
	}
	ans -= cnt;
	if (ans == 0) {
		cout << "0" << endl;
		return 0;
	}
	int x=0;
	if(cnt>=1)
		x=1;
	cout << ans*m*2+x*m << endl;
	for (int i = 0; i < ans+cnt; i++) {
		if(!ff[i][2])
			cout << S[ff[i][0]];
	}
	for (int i = 0; i < ans+cnt; i++) {
		if (ff[i][2]) {
			cout << S[ff[i][0]];
			break;
		}
	}
	for (int i = ans+cnt - 1; i >= 0; i--) {
		if (!ff[i][2])
			cout << S[ff[i][1]];
	}
}


#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<numeric>
#include<deque>
using namespace std;
typedef long long ll;
int main()
{
	int n, m;
	cin >> n >> m;
	vector<string> s(n);
	vector<string> k(n);
	vector<int> flag(n, 0);
	string bb = "";
	for (int i = 0; i < n; i++)
	{
		cin >> s[i];
		k[i] = s[i];
		reverse(k[i].begin(), k[i].end());
		if (s[i] == k[i])
			flag[i] = 2;
	}
	for (int i = 0; i < n; i++)
	{
		if (flag[i] == 1||flag[i] == 2)
			continue;
		for (int j = i + 1; j < n; j++)
		{
			if (k[i] == s[j] && flag[j] == 0)
			{
				flag[j] = 1;
				bb += s[i];
				break;
			}
		}
		flag[i] = 1;
	}
	string aa=bb;
	reverse(aa.begin(),aa.end());
	for (int i = 0; i < n; i++)
	{
		if (flag[i] == 2)
		{
			bb += s[i];
			break;
		}
	}
	cout << bb.length()+aa.length() << endl;
	cout << bb+aa << endl;
	return 0;
}


#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<numeric>
#include<deque>
using namespace std;
typedef long long ll;
int main()
{
	int n, m;
	cin >> n >> m;
	vector<string> s(n);
	vector<string> k(n);
	vector<int> flag(n, 0);
	string bb = "";
	for (int i = 0; i < n; i++)
	{
		cin >> s[i];
		k[i] = s[i];
		reverse(k[i].begin(), k[i].end());
		if (s[i] == k[i])
			flag[i] = 2;
	}
	for (int i = 0; i < n; i++)
	{
		if (flag[i] == 1)
			continue;
		for (int j = i + 1; j < n; j++)
		{
			if (k[i] == s[j] && flag[j] == 0)
			{
				flag[j] = 1;
				bb += s[i];
				break;
			}
		}
	}
	for (int i = 0; i < n; i++)
	{
		if (flag[i] == 2)
		{
			bb += s[i];
			break;
		}
	}
	for (int i = n - 1; i >= 0; i--)
	{
		if (flag[i] == 1)
			bb += s[i];
	}
	cout << bb.length() << endl;
	cout << bb << endl;
	return 0;
}


#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<numeric>
#include<deque>
using namespace std;
typedef long long ll;
int main()
{
	int n,m;
	cin>>n>>m;
	vector<string> s(n);
	vector<string> k(n);
	vector<int> flag(n,0);
	string bb;
	for(int i=0;i<n;i++)
	{
		cin>>s[i];
		k[i]=s[i];
		reverse(k[i].begin(),k[i].end());
		if(s[i]==k[i])
			flag[i]=2;
	}
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			if(k[i]==s[j]&&flag[j]!=1)
			{
				flag[j]=1;
				bb+=s[i];
				break;
			}
		}
	}
	for(int i=0;i<n;i++)
	{
		if(flag[i]==2)
		{
			bb+=s[i];
			break;
		}
	}
	for(int i=n-1;i>=0;i--)
	{
		if(flag[i]==1)
			bb+=s[i];
	}
	cout<<bb.length()<<endl;
	cout<<bb<<endl;
	return 0;
}


#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<numeric>
#include<deque>
using namespace std;
typedef long long ll;
int main()
{
	int n,m;
	cin>>n>>m;
	vector<string> s(n);
	vector<string> k(n);
	vector<int> flag(n,0);
	string bb;
	for(int i=0;i<n;i++)
	{
		cin>>s[i];
		k[i]=s[i];
		reverse(k[i].begin(),k[i].end());
		if(s[i]==k[i])
			flag[i]=2;
	}
	for(int i=0;i<n;i++)
	{
		if(flag[i]==1)
			continue;
		for(int j=i+1;j<n;j++)
		{
			if(k[i]==s[j]&&flag[j]!=1)
			{
				flag[j]=1;
				bb+=s[i];
				break;
			}
		}
	}
	for(int i=0;i<n;i++)
	{
		if(flag[i]==2)
		{
			bb+=s[i];
			break;
		}
	}
	for(int i=n-1;i>=0;i--)
	{
		if(flag[i]==1)
			bb+=s[i];
	}
	cout<<bb.length()<<endl;
	cout<<bb<<endl;
	return 0;
}


#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<numeric>
#include<deque>
using namespace std;
typedef long long ll;
int main()
{
	int n,m;
	cin>>n>>m;
	vector<string> s(n);
	vector<string> k(n);
	vector<int> flag(n,0);
	string bb;
	for(int i=0;i<n;i++)
	{
		cin>>s[i];
		k[i]=s[i];
		reverse(k[i].begin(),k[i].end());
		if(s[i]==k[i])
			flag[i]=2;
	}
	for(int i=0;i<n;i++)
	{
		if(flag[i]==1)
			continue;
		for(int j=i+1;j<n;j++)
		{
			if(k[i]==s[j]&&flag[j]!=1)
			{
				if(flag[i]==2)
					flag[i]=0;
				flag[j]=1;
				bb+=s[i];
				break;
			}
		}
	}
	for(int i=0;i<n;i++)
	{
		if(flag[i]==2)
		{
			bb+=s[i];
			break;
		}
	}
	for(int i=n-1;i>=0;i--)
	{
		if(flag[i]==1)
			bb+=s[i];
	}
	cout<<bb.length()<<endl;
	cout<<bb<<endl;
	return 0;
}


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

int main() {
    int n,m;
    cin>>n>>m;
    string s[n];
    for(int i=0;i<n;i++){
        cin>>s[i];
    }
    map<string,int> m1;
    for(int i=0;i<n;i++){
        m1[s[i]]++;
    }
    int c=0;
    bool r=true;
    string ans="";
   for(int i=0;i<n;i++){
       string t;
       t=s[i];
       reverse(s[i].begin(),s[i].end());
       if(t==s[i] && r && m1[t]%2!=0){
           c+=m;
           r=false;
           m1[t]--;
           int len=ans.length();
           //cout<<len;
          if(len>0)
          {
              string r = ans.substr(0, (len/2));
              //cout<<r<<t<<endl;
              r+=t;

              string r1 = ans.substr((len/2), len-1);
              //cout<<r1<<endl;
              r+=r1;
              //cout<<r
              ans=r;

          }
           //ans+=t;
       }
      else if(t==s[i] && !r && m1[t]%2==0 && m1[t]>0){
          cout<<"k";
          c+=(2*m);
          m1[t]--;
          m1[t]--;
          ans+=t;
          t+=ans;
          ans=t;
      }
       else if(s[i]!=t && m1[s[i]]>0){
           c+=(2*m);
           m1[s[i]]--;
           m1[t]--;

          ans+=t;
          s[i]+=ans;
          ans=s[i];
       }

   }
          cout<<c<<endl<<ans;

	return 0;
}


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

int main() {
    int n,m;
    cin>>n>>m;
    string s[n];
    for(int i=0;i<n;i++){
        cin>>s[i];
    }
    map<string,int> m1;
    for(int i=0;i<n;i++){
        m1[s[i]]++;
    }
    int c=0;
    bool r=true;
    string ans="";
   for(int i=0;i<n;i++){
       string t;
       t=s[i];
       reverse(s[i].begin(),s[i].end());
       if(t==s[i] && r && m1[t]%2!=0){
           c+=m;
           r=false;
           m1[t]--;
           int len=ans.length();
           //cout<<len;
          if(len>0)
          {
              string r = ans.substr(0, (len/2));
              //cout<<r<<t<<endl;
              r+=t;

              string r1 = ans.substr((len/2), len-1);
              //cout<<r1<<endl;
              r+=r1;
              //cout<<r
              ans=r;

          }
           //ans+=t;
       }
      else if(t==s[i] && r && m1[t]%2==0 && m1[t]>0){
          //cout<<"k";
          c+=(2*m);
          m1[t]--;
          m1[t]--;
          ans+=t;
          t+=ans;
          ans=t;
      }
       else if(s[i]!=t && m1[s[i]]>0){
           c+=(2*m);
           m1[s[i]]--;
           m1[t]--;

          ans+=s[i];
           t+=ans;
          ans=t;
       }

   }
          cout<<c<<endl<<ans;

	return 0;
}


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

int main() {
    int n,m;
    cin>>n>>m;
    string s[n];
    for(int i=0;i<n;i++){
        cin>>s[i];
    }
    map<string,int> m1;
    for(int i=0;i<n;i++){
        m1[s[i]]++;
    }
    int c=0;
    bool r=true;
    string ans="";
   for(int i=0;i<n;i++){
       string t;
       t=s[i];
       reverse(s[i].begin(),s[i].end());
       if(t==s[i] && r && m1[t]%2!=0){
           c+=m;
           r=false;
           m1[t]--;
           int len=ans.length();
           //cout<<len;
          if(len>0)
          {
              string r = ans.substr(0, (len/2));
              //cout<<r<<t<<endl;
              r+=t;

              string r1 = ans.substr((len/2), len-1);
              //cout<<r1<<endl;
              r+=r1;
              //cout<<r
              ans=r;

          }
           else ans+=t;
       }
      else if(t==s[i] && !r && m1[t]%2==0 && m1[t]>0){
          //cout<<"k";
          c+=(2*m);
          m1[t]--;
          m1[t]--;
          ans+=t;
          t+=ans;
          ans=t;
      }
       else if(s[i]!=t && m1[s[i]]>0){
           c+=(2*m);
           m1[s[i]]--;
           m1[t]--;

          ans+=s[i];
           t+=ans;
          ans= t;
       }

   }
          cout<<c<<endl<<ans;

	return 0;
}


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

int main() {
    int n,m;
    cin>>n>>m;
    string s[n];
    for(int i=0;i<n;i++){
        cin>>s[i];
    }
    map<string,int> m1;
    for(int i=0;i<n;i++){
        m1[s[i]]++;
    }
    int c=0;
    bool r=true;
    string ans="";
   for(int i=0;i<n;i++){
       string t;
       t=s[i];
       reverse(s[i].begin(),s[i].end());
       if(t==s[i] && r && m1[t]%2!=0){
           c+=m;
           r=false;
           m1[t]--;
           int len=ans.length();
           //cout<<len;
          if(len>0)
          {
              string r = ans.substr(0, (len/2));
              //cout<<r<<t<<endl;
              r+=t;

              string r1 = ans.substr((len/2), len-1);
              //cout<<r1<<endl;
              r+=r1;
              //cout<<r
              ans=r;

          }
           //ans+=t;
       }
      else if(t==s[i] && !r && m1[t]%2==0 && m1[t]>0){
          cout<<"k";
          c+=(2*m);
          m1[t]--;
          m1[t]--;
          ans+=t;
          t+=ans;
          ans=t;
      }
       else if(s[i]!=t && m1[s[i]]>0){
           c+=(2*m);
           m1[s[i]]--;
           m1[t]--;

          ans+=s[i];
           t+=ans;
          ans=t;
       }

   }
          cout<<c<<endl<<ans;

	return 0;
}


#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
int main()
{
   int n,k;
    cin>>n>>k;
    string s[n];
    set<string>v;
    vector<string>l,r;
    unordered_map<string,int>m;
    for(int i=0;i<n;i++)
    {

    	 cin>>s[i];
    	 v.insert(s[i]);
    }
    string mid;
    for(int i=0;i<n;i++)
    {
        string t=s[i];
        reverse(t.begin(),t.end());
        if(t==s[i])
        mid=t;
        else if(v.find(t)!=v.end())
        {
            l.push_back(s[i]);
            r.push_back(t);
            v.erase(s[i]);
            v.erase(t);
        }

    }
    string ans="";
    for(int i=0;i<l.size();i++)
    ans+=l[i];
    //cout<<ans<<c[0]<<endl;
    ans+=mid;
   // cout<<ans;
    for(int i=r.size()-1;i>=0;i--)
    ans+=r[i];
    cout<<ans.size()<<endl;
    cout<<ans;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
   int n,k;
    cin>>n>>k;
    char x;
    vector<string>v,l,r,c,t;
    unordered_map<string,int>m;
    for(int i=0;i<n;i++)
    {
        string s="";

        for(int j=0;j<k;j++)
        {
        cin>>x;
        s+=x;
        }
        v.push_back(s);
        t.push_back(s);

        m[s]++;
    }
    for(int i=0;i<n;i++)
    {
        reverse(v[i].begin(),v[i].end());
        if(m[v[i]]>0)
        {
            m[v[i]]--;
            m[t[i]]--;
            if(m[v[i]]<0)
            c.push_back(v[i]);
            else
            {l.push_back(t[i]);
            r.push_back(v[i]);}
        }

    }
    //int max=INT_MIN;
    //string ch;
    /*for(int i=0;i<c.size();i++)
    {
        if(c[i].size()>max)
        {
            max=c[i].size();
            ch=c[i];
            ch[c[i].size()]='\0';
        }
    }*/
    string ans="";
    for(int i=0;i<l.size();i++)
    ans+=l[i];
    ans+=c[0];
    for(int i=r.size()-1;i>=0;i--)
    ans+=r[i];
    cout<<ans.size()<<endl;
    cout<<ans;

}


#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
int main()
{
   int n,k;
    cin>>n>>k;
    string s[n];
    vector<string>v,l,r,c,t;
    unordered_map<string,int>m;
    for(int i=0;i<n;i++)
    {

    	 cin>>s[i];

       /* for(int j=0;j<k;j++)
        {
        cin>>x;
        s+=x;
        }*/
        v.push_back(s[i]);
        t.push_back(s[i]);

        m[s[i]]++;
    }
    for(int i=0;i<n;i++)
    {
    	//cout<<v[i]<<endl;
    	if(m[v[i]]>0)
        reverse(v[i].begin(),v[i].end());
       // cout<<v[i]<<endl;
        if(m[v[i]]>0)
        {
            m[v[i]]--;
            m[t[i]]--;
            if(m[v[i]]<0)
            c.push_back(v[i]);
            else
            {l.push_back(t[i]);
            r.push_back(v[i]);}
        }

    }
    string ans="";
    for(int i=0;i<l.size();i++)
    ans+=l[i];
    //cout<<ans<<c[0]<<endl;
    ans+=c[0];
   // cout<<ans;
    for(int i=r.size()-1;i>=0;i--)
    ans+=r[i];
    cout<<ans.size()<<endl;
    cout<<ans;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
   int n,k;
    cin>>n>>k;
    string s;
    vector<string>v,l,r,c,t;
    unordered_map<string,int>m;
    for(int i=0;i<n;i++)
    {
        cin>>s;
        v.push_back(s);
        t.push_back(s);

        m[s]++;
    }
    for(int i=0;i<n;i++)
    {
        reverse(v[i].begin(),v[i].end());
        if(m[v[i]]>0)
        {
            m[v[i]]--;
            m[t[i]]--;
            if(m[v[i]]<0)
            c.push_back(v[i]);
            else
            {l.push_back(t[i]);
            r.push_back(v[i]);}
        }
        /*for(int j=0;j<m/2;j++)
        {
            if(v[i][j]!=v[i][m-1-j])
            {
                k=1;
                break;
            }

        }
        if(k==0)
        c.push_back()
        */

    }
    int max=INT_MIN;
    string ch;
    for(int i=0;i<c.size();i++)
    {
        if(c[i].size()>max)
        {
            max=c[i].size();
            ch=c[i];
            ch[c[i].size()]='\0';
        }
    }
    string ans="";
    for(int i=0;i<l.size();i++)
    ans+=l[i];
    ans+=ch;
    for(int i=r.size()-1;i>=0;i++)
    ans+=r[i];
    cout<<ans.size()<<endl;
    cout<<ans;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
   int n,k;
    cin>>n>>k;
    string s;
    char x;
    vector<string>v,l,r,c,t;
    unordered_map<string,int>m;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<k;j++)
        {
        cin>>x;
        s+=x;
        }
        v.push_back(s);
        t.push_back(s);

        m[s]++;
    }
    for(int i=0;i<n;i++)
    {
        reverse(v[i].begin(),v[i].end());
        if(m[v[i]]>0)
        {
            m[v[i]]--;
            m[t[i]]--;
            if(m[v[i]]<0)
            c.push_back(v[i]);
            else
            {l.push_back(t[i]);
            r.push_back(v[i]);}
        }
        /*for(int j=0;j<m/2;j++)
        {
            if(v[i][j]!=v[i][m-1-j])
            {
                k=1;
                break;
            }

        }
        if(k==0)
        c.push_back()
        */

    }
    int max=INT_MIN;
    string ch;
    for(int i=0;i<c.size();i++)
    {
        if(c[i].size()>max)
        {
            max=c[i].size();
            ch=c[i];
            ch[c[i].size()]='\0';
        }
    }
    string ans="";
    for(int i=0;i<l.size();i++)
    ans+=l[i];
    ans+=ch;
    for(int i=r.size()-1;i>=0;i++)
    ans+=r[i];
    cout<<ans.size()<<endl;
    cout<<ans;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
   int n,k;
    cin>>n>>k;
    string s="";
    char x;
    vector<string>v,l,r,c,t;
    unordered_map<string,int>m;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<k;j++)
        {
        cin>>x;
        s+=x;
        }
        v.push_back(s);
        t.push_back(s);

        m[s]++;
    }
    for(int i=0;i<n;i++)
    {
        reverse(v[i].begin(),v[i].end());
        if(m[v[i]]>0)
        {
            m[v[i]]--;
            m[t[i]]--;
            if(m[v[i]]<0)
            c.push_back(v[i]);
            else
            {l.push_back(t[i]);
            r.push_back(v[i]);}
        }
        /*for(int j=0;j<m/2;j++)
        {
            if(v[i][j]!=v[i][m-1-j])
            {
                k=1;
                break;
            }

        }
        if(k==0)
        c.push_back()
        */

    }
    int max=INT_MIN;
    string ch;
    for(int i=0;i<c.size();i++)
    {
        if(c[i].size()>max)
        {
            max=c[i].size();
            ch=c[i];
            ch[c[i].size()]='\0';
        }
    }
    string ans="";
    for(int i=0;i<l.size();i++)
    ans+=l[i];
    ans+=ch;
    for(int i=r.size()-1;i>=0;i++)
    ans+=r[i];
    cout<<ans.size()<<endl;
    cout<<ans;

}


#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
int main()
{
   int n,k;
    cin>>n>>k;
    char x;
    vector<string>v,l,r,c,t;
    unordered_map<string,int>m;
    for(int i=0;i<n;i++)
    {
    	 string s="";

        for(int j=0;j<k;j++)
        {
        cin>>x;
        s+=x;
        }
        v.push_back(s);
        t.push_back(s);

        m[s]++;
    }
    for(int i=0;i<n;i++)
    {
    	//cout<<v[i]<<endl;
        reverse(v[i].begin(),v[i].end());
       // cout<<v[i]<<endl;
        if(m[v[i]]>0)
        {
            m[v[i]]--;
            m[t[i]]--;
            if(m[v[i]]<0)
            c.push_back(v[i]);
            else
            {l.push_back(t[i]);
            r.push_back(v[i]);}
        }

    }
    //int max=INT_MIN;
    //string ch;
   /* for(int i=0;i<c.size();i++)
    {
        if(c[i].size()>max)
        {
            max=c[i].size();
            ch=c[i];
            ch[c[i].size()]='\0';
        }
       cout<<c[i]<<endl;
    }*/
    string ans="";
    for(int i=0;i<l.size();i++)
    ans+=l[i];
    //cout<<ans<<c[0]<<endl;
    ans+=c[0];
   // cout<<ans;
    for(int i=r.size()-1;i>=0;i--)
    ans+=r[i];
    cout<<ans.size()<<endl;
    cout<<ans;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
   int n,k;
    cin>>n>>k;
    string s;
    vector<string>v,l,r,c,t;
    unordered_map<string,int>m;
    for(int i=0;i<n;i++)
    {
        cin>>s;
        v.push_back(s);
        t.push_back(s);

        m[s]++;
    }
    for(int i=0;i<n;i++)
    {
        reverse(v[i].begin(),v[i].end());
        if(m[v[i]]>0)
        {
            m[v[i]]--;
            m[t[i]]--;
            if(m[v[i]]<0)
            c.push_back(v[i]);
            else
            {l.push_back(t[i]);
            r.push_back(v[i]);}
        }
        /*for(int j=0;j<m/2;j++)
        {
            if(v[i][j]!=v[i][m-1-j])
            {
                k=1;
                break;
            }

        }
        if(k==0)
        c.push_back()
        */

    }
    int max=INT_MIN;
    string ch;
    for(int i=0;i<c.size();i++)
    {
        if(c[i].size()>max)
        {
            max=c[i].size();
            ch=c[i];
            ch[c[i].size()]='\0';
        }
    }
    string ans="";
    for(int i=0;i<l.size();i++)
    ans+=l[i];
    ans+=ch;
    for(int i=0;i<r.size();i++)
    ans+=r[i];
    cout<<ans.size()<<endl;
    cout<<ans;

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long llu;
const ll inf = 1e9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const ll MAX = 1e7 + 20;
#define fast ios_base:: sync_with_stdio( false ); cin.tie(0); cout.tie(0);
#define eb              emplace_back
#define em              emplace
#define pb              push_back
#define Mp              make_pair
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define rep(i,n)        for(int i=0;i<n;i++)
#define rep1(i,n)       for(int i=1;i<=n;i++)
#define rrep(i,a,n)     for(int i=a;i<=n;i++)
#define per(i,n,a)      for(int i=n;i>=a;i--)
#define pf(n)           printf("%lld",n)
#define pfi(n)          printf("%d",n)
#define sp              printf(" ")
#define ln              "\n"

#define pi acos(-1.0)
#define mod 1000000007

///Library
#define mem(a,b) memset(a,b,sizeof(a))
#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define SortA(ar,s) sort(ar,ar+s)
#define SortD(ar,s) sort(ar,ar+s,greater<int>())
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sq(x) (x)*(x)

///vector
#define Lower_bound(vec,value) lower_bound(vec.begin(),vec.end(),value)
#define Upper_bound(vec,value) upper_bound(vec.begin(),vec.end(),value)

//template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
//template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
ll x[26];

int main()
{
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/

    fast
    ll a,b;

    cin>>a>>b;
    string c[a];
    for(int i=0; i<a; i++)
    {
        cin>>c[i];
    }
    deque<string>l;
    vector<string>v;
    ll flag=0,flag1=0;
    for(int i=0; i<a; i++)
    {
        string d;
        d=c[i];
        reverse(d.begin(),d.end());
        for(int j=i+1; j<a; j++)
        {
            if(j!=i && d==c[j])
            {
                l.push_back(c[j]);
                l.push_front(c[i]);
                flag1=1;
                break;
            }
            flag1=0;
        }
        if(d==c[i] && flag==0 && flag1==0)
        {
            flag=1;
            v.push_back(d);
        }
    }
    ll sum=l.size();
    if(flag==1)
    {
        sum++;
    }
    cout<<sum*b<<endl;
    for(int i=0; i<l.size(); i++)
    {
        cout<<l[i];
        if(((sum-1)/2)==i+1)
        {
            cout<<v[0];
        }
    }
    cout<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long llu;
const ll inf = 1e9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const ll MAX = 1e7 + 20;
#define fast ios_base:: sync_with_stdio( false ); cin.tie(0); cout.tie(0);
#define eb              emplace_back
#define em              emplace
#define pb              push_back
#define Mp              make_pair
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define rep(i,n)        for(int i=0;i<n;i++)
#define rep1(i,n)       for(int i=1;i<=n;i++)
#define rrep(i,a,n)     for(int i=a;i<=n;i++)
#define per(i,n,a)      for(int i=n;i>=a;i--)
#define pf(n)           printf("%lld",n)
#define pfi(n)          printf("%d",n)
#define sp              printf(" ")
#define ln              "\n"

#define pi acos(-1.0)
#define mod 1000000007

///Library
#define mem(a,b) memset(a,b,sizeof(a))
#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define SortA(ar,s) sort(ar,ar+s)
#define SortD(ar,s) sort(ar,ar+s,greater<int>())
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sq(x) (x)*(x)

///vector
#define Lower_bound(vec,value) lower_bound(vec.begin(),vec.end(),value)
#define Upper_bound(vec,value) upper_bound(vec.begin(),vec.end(),value)

//template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
//template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
ll x[26];

int main()
{
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/

    fast
    ll a,b;

    cin>>a>>b;
    string c[a];
    for(int i=0; i<a; i++)
    {
        cin>>c[i];
    }
    deque<string>l;
    vector<string>v;
    ll flag=0,flag1=0;
    for(int i=0; i<a; i++)
    {
        string d;
        d=c[i];
        reverse(d.begin(),d.end());
        for(int j=i+1; j<a; j++)
        {
            if(j!=i && d==c[j])
            {
                l.push_back(c[j]);
                l.push_front(c[i]);
                flag1=1;
                break;
            }
            flag1=0;
        }
        if(d==c[i] && flag==0 && flag1==0)
        {
            flag=1;
            v.push_back(d);
        }
    }
    ll sum=l.size();
    if(flag==1)
    {
        sum++;
    }
    cout<<sum*b<<endl;
    if(a==1)
    {
        string d;
        d=c[0];
        reverse(d.begin(),d.end());
        if(d==c[0])
        {
            cout<<d<<endl;
            return 0;
        }
    }
    for(int i=0; i<l.size(); i++)
    {
        cout<<l[i];
        if(((sum-1)/2)==i+1)
        {
            cout<<v[0];
        }
    }
    cout<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long llu;
const ll inf = 1e9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const ll MAX = 1e7 + 20;
#define fast ios_base:: sync_with_stdio( false ); cin.tie(0); cout.tie(0);
#define eb              emplace_back
#define em              emplace
#define pb              push_back
#define Mp              make_pair
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define rep(i,n)        for(int i=0;i<n;i++)
#define rep1(i,n)       for(int i=1;i<=n;i++)
#define rrep(i,a,n)     for(int i=a;i<=n;i++)
#define per(i,n,a)      for(int i=n;i>=a;i--)
#define pf(n)           printf("%lld",n)
#define pfi(n)          printf("%d",n)
#define sp              printf(" ")
#define ln              "\n"

#define pi acos(-1.0)
#define mod 1000000007

///Library
#define mem(a,b) memset(a,b,sizeof(a))
#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define SortA(ar,s) sort(ar,ar+s)
#define SortD(ar,s) sort(ar,ar+s,greater<int>())
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sq(x) (x)*(x)

///vector
#define Lower_bound(vec,value) lower_bound(vec.begin(),vec.end(),value)
#define Upper_bound(vec,value) upper_bound(vec.begin(),vec.end(),value)

//template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
//template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
ll x[26];

int main()
{
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/

    fast
    ll a,b;

    cin>>a>>b;
    string c[a];
    for(int i=0; i<a; i++)
    {
        cin>>c[i];
    }
    deque<string>l;
    vector<string>v;
    ll flag=0,flag1=0;
    for(int i=0; i<a; i++)
    {
        string d;
        d=c[i];
        reverse(d.begin(),d.end());
        for(int j=i+1; j<a; j++)
        {
            if(j!=i && d==c[j])
            {
                l.push_back(c[j]);
                l.push_front(c[i]);
                flag1=1;
                break;
            }
            flag1=0;
        }
        if(d==c[i] && flag==0 && flag1==0)
        {
            flag=1;
            v.push_back(d);
        }
    }
    ll sum=l.size();
    if(flag==1)
    {
        sum++;
    }
    cout<<sum*b<<endl;
    for(int i=0; i<l.size(); i++)
    {
        cout<<l[i];
        if(((sum-1)/2)==i+1 && i+1<l.size())
        {
            cout<<v[0];
        }
    }
    cout<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long llu;
const ll inf = 1e9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const ll MAX = 1e7 + 20;
#define fast ios_base:: sync_with_stdio( false ); cin.tie(0); cout.tie(0);
#define eb              emplace_back
#define em              emplace
#define pb              push_back
#define Mp              make_pair
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define rep(i,n)        for(int i=0;i<n;i++)
#define rep1(i,n)       for(int i=1;i<=n;i++)
#define rrep(i,a,n)     for(int i=a;i<=n;i++)
#define per(i,n,a)      for(int i=n;i>=a;i--)
#define pf(n)           printf("%lld",n)
#define pfi(n)          printf("%d",n)
#define sp              printf(" ")
#define ln              "\n"

#define pi acos(-1.0)
#define mod 1000000007

///Library
#define mem(a,b) memset(a,b,sizeof(a))
#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define SortA(ar,s) sort(ar,ar+s)
#define SortD(ar,s) sort(ar,ar+s,greater<int>())
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sq(x) (x)*(x)

///vector
#define Lower_bound(vec,value) lower_bound(vec.begin(),vec.end(),value)
#define Upper_bound(vec,value) upper_bound(vec.begin(),vec.end(),value)

//template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
//template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
ll x[26];

int main()
{
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/

    fast
    ll a,b;

    cin>>a>>b;
    string c[a];
    for(int i=0; i<a; i++)
    {
        cin>>c[i];
    }
    deque<string>l;
    vector<string>v;
    ll flag=0,flag1=0;
    if(a!=1)
    {
        for(int i=0; i<a; i++)
        {
            string d;
            d=c[i];
            reverse(d.begin(),d.end());
            for(int j=0; j<a; j++)
            {
                if(j!=i && d==c[j])
                {
                    l.push_back(c[j]);
                    l.push_front(c[i]);
                    flag1=1;
                    break;
                }
                flag1=0;
            }
            if(d==c[i] && flag==0 && flag1==0)
            {
                flag=1;
                v.push_back(d);
            }
        }
    }
    ll sum=l.size();
    if(a==1)
    {
        string d;
        d=c[0];
        reverse(d.begin(),d.end());
        if(d==c[0])
        {
            cout<<++sum*b<<endl<<d<<endl;
            return 0;
        }
    }
    if(flag==1)
    {
        sum++;
    }
    cout<<sum*b<<endl;
    for(int i=0; i<l.size(); i++)
    {
        cout<<l[i];
        if(((sum-1)/2)==i+1)
        {
            cout<<v[0];
        }
    }
    cout<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long llu;
const ll inf = 1e9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const ll MAX = 1e7 + 20;
#define fast ios_base:: sync_with_stdio( false ); cin.tie(0); cout.tie(0);
#define eb              emplace_back
#define em              emplace
#define pb              push_back
#define Mp              make_pair
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define rep(i,n)        for(int i=0;i<n;i++)
#define rep1(i,n)       for(int i=1;i<=n;i++)
#define rrep(i,a,n)     for(int i=a;i<=n;i++)
#define per(i,n,a)      for(int i=n;i>=a;i--)
#define pf(n)           printf("%lld",n)
#define pfi(n)          printf("%d",n)
#define sp              printf(" ")
#define ln              "\n"

#define pi acos(-1.0)
#define mod 1000000007

///Library
#define mem(a,b) memset(a,b,sizeof(a))
#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define SortA(ar,s) sort(ar,ar+s)
#define SortD(ar,s) sort(ar,ar+s,greater<int>())
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sq(x) (x)*(x)

///vector
#define Lower_bound(vec,value) lower_bound(vec.begin(),vec.end(),value)
#define Upper_bound(vec,value) upper_bound(vec.begin(),vec.end(),value)

//template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
//template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
ll x[26];

int main()
{
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/

    fast
    ll a,b;

    cin>>a>>b;
    string c[a];
    for(int i=0; i<a; i++)
    {
        cin>>c[i];
    }
    deque<string>l;
    vector<string>v;
    set<string>s;
    ll flag=0,flag1=0;
    if(a!=1)
    {
        for(int i=0; i<a; i++)
        {
            string d;
            d=c[i];
            reverse(d.begin(),d.end());
            for(int j=i+1; j<a; j++)
            {
                if(j!=i && d==c[j] && s.find(d)==s.end())
                {
                    l.push_back(c[j]);
                    l.push_front(c[i]);
                    s.insert(c[j]);
                    s.insert(c[i]);
                    flag1=1;
                    break;
                }
                flag1=0;
            }
            if(d==c[i] && flag==0 && flag1==0)
            {
                flag=1;
                v.push_back(d);
            }
        }
    }
    ll sum=l.size();
    if(a==1)
    {
        string d;
        d=c[0];
        reverse(d.begin(),d.end());
        if(d==c[0])
        {
            cout<<++sum*b<<endl<<d<<endl;
            return 0;
        }
    }
    if(flag==1)
    {
        sum++;
    }
    cout<<sum*b<<endl;
    for(int i=0; i<l.size(); i++)
    {
        cout<<l[i];
        if(((sum-1)/2)==i+1)
        {
            cout<<v[0];
        }
    }
    cout<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long llu;
const ll inf = 1e9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const ll MAX = 1e7 + 20;
#define fast ios_base:: sync_with_stdio( false ); cin.tie(0); cout.tie(0);
#define eb              emplace_back
#define em              emplace
#define pb              push_back
#define Mp              make_pair
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define rep(i,n)        for(int i=0;i<n;i++)
#define rep1(i,n)       for(int i=1;i<=n;i++)
#define rrep(i,a,n)     for(int i=a;i<=n;i++)
#define per(i,n,a)      for(int i=n;i>=a;i--)
#define pf(n)           printf("%lld",n)
#define pfi(n)          printf("%d",n)
#define sp              printf(" ")
#define ln              "\n"

#define pi acos(-1.0)
#define mod 1000000007

///Library
#define mem(a,b) memset(a,b,sizeof(a))
#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define SortA(ar,s) sort(ar,ar+s)
#define SortD(ar,s) sort(ar,ar+s,greater<int>())
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sq(x) (x)*(x)

///vector
#define Lower_bound(vec,value) lower_bound(vec.begin(),vec.end(),value)
#define Upper_bound(vec,value) upper_bound(vec.begin(),vec.end(),value)

//template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
//template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
ll x[26];

int main()
{
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/

    fast
    ll a,b;

    cin>>a>>b;
    string c[a];
    for(int i=0; i<a; i++)
    {
        cin>>c[i];
    }
    deque<string>l;
    vector<string>v;
    set<string>s;
    ll flag=0,flag1=0;
    if(a!=1)
    {
        for(int i=0; i<a; i++)
        {
            string d;
            d=c[i];
            reverse(d.begin(),d.end());
            for(int j=0; j<a; j++)
            {
                if(j!=i && d==c[j] && s.find(d)==s.end() && s.find(c[i])==s.end())
                {
                    l.push_back(c[j]);
                    l.push_front(c[i]);
                    s.insert(c[j]);
                    s.insert(c[i]);
                    flag1=1;
                    break;
                }
                flag1=0;
            }
            if(d==c[i] && flag==0 && flag1==0)
            {
                flag=1;
                v.push_back(d);
            }
        }
    }
    ll sum=l.size();
    if(a==1)
    {
        string d;
        d=c[0];
        reverse(d.begin(),d.end());
        if(d==c[0])
        {
            cout<<++sum*b<<endl<<d<<endl;
            return 0;
        }
    }
    if(flag==1)
    {
        sum++;
    }
    cout<<sum*b<<endl;
    for(int i=0; i<l.size(); i++)
    {
        cout<<l[i];
        if(v.size()!=0 && ((sum-1)/2)==i+1)
        {
            cout<<v[0];
        }
    }
    cout<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long llu;
const ll inf = 1e9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const ll MAX = 1e7 + 20;
#define fast ios_base:: sync_with_stdio( false ); cin.tie(0); cout.tie(0);
#define eb              emplace_back
#define em              emplace
#define pb              push_back
#define Mp              make_pair
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define rep(i,n)        for(int i=0;i<n;i++)
#define rep1(i,n)       for(int i=1;i<=n;i++)
#define rrep(i,a,n)     for(int i=a;i<=n;i++)
#define per(i,n,a)      for(int i=n;i>=a;i--)
#define pf(n)           printf("%lld",n)
#define pfi(n)          printf("%d",n)
#define sp              printf(" ")
#define ln              "\n"

#define pi acos(-1.0)
#define mod 1000000007

///Library
#define mem(a,b) memset(a,b,sizeof(a))
#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define SortA(ar,s) sort(ar,ar+s)
#define SortD(ar,s) sort(ar,ar+s,greater<int>())
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sq(x) (x)*(x)

///vector
#define Lower_bound(vec,value) lower_bound(vec.begin(),vec.end(),value)
#define Upper_bound(vec,value) upper_bound(vec.begin(),vec.end(),value)

//template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
//template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
ll x[26];

int main()
{
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/

    fast
    ll a,b;

    cin>>a>>b;
    string c[a];
    for(int i=0; i<a; i++)
    {
        cin>>c[i];
    }
    deque<string>l;
    vector<string>v;
    set<string>s;
    ll flag=0,flag1=0;
    {
        for(int i=0; i<a; i++)
        {
            string d;
            d=c[i];
            reverse(d.begin(),d.end());
            for(int j=0; j<a; j++)
            {
                if(j!=i && d==c[j] && s.find(d)==s.end() && s.find(c[i])==s.end())
                {
                    l.push_back(c[j]);
                    l.push_front(c[i]);
                    s.insert(c[j]);
                    s.insert(c[i]);
                    flag1=1;
                    break;
                }
                flag1=0;
            }
            if(d==c[i] && flag==0 && flag1==0)
            {
                flag=1;
                v.push_back(d);
            }
        }
    }
    ll sum=l.size();

    if(sum==0)
    {
        for(int i=0; i<a; i++)
        {
            string d;
            d=c[i];
            reverse(d.begin(),d.end());
            for(int j=0; j<a; j++)
            {
                if(d==c[j])
                {
                    cout<<d.size()<<endl<<d<<endl;
                    return 0;
                }
            }
        }
    }
    if(flag==1)
    {
        sum++;
    }
    cout<<sum*b<<endl;
    for(int i=0; i<l.size(); i++)
    {
        cout<<l[i];
        if(v.size()!=0 && ((sum-1)/2)==i+1)
        {
            cout<<v[0];
        }
    }
    cout<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long llu;
const ll inf = 1e9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const ll MAX = 1e7 + 20;
#define fast ios_base:: sync_with_stdio( false ); cin.tie(0); cout.tie(0);
#define eb              emplace_back
#define em              emplace
#define pb              push_back
#define Mp              make_pair
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define rep(i,n)        for(int i=0;i<n;i++)
#define rep1(i,n)       for(int i=1;i<=n;i++)
#define rrep(i,a,n)     for(int i=a;i<=n;i++)
#define per(i,n,a)      for(int i=n;i>=a;i--)
#define pf(n)           printf("%lld",n)
#define pfi(n)          printf("%d",n)
#define sp              printf(" ")
#define ln              "\n"

#define pi acos(-1.0)
#define mod 1000000007

///Library
#define mem(a,b) memset(a,b,sizeof(a))
#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define SortA(ar,s) sort(ar,ar+s)
#define SortD(ar,s) sort(ar,ar+s,greater<int>())
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sq(x) (x)*(x)

///vector
#define Lower_bound(vec,value) lower_bound(vec.begin(),vec.end(),value)
#define Upper_bound(vec,value) upper_bound(vec.begin(),vec.end(),value)

//template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
//template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
ll x[26];

int main()
{
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/

    fast
    ll a,b;

    cin>>a>>b;
    string c[a];
    for(int i=0; i<a; i++)
    {
        cin>>c[i];
    }
    deque<string>l;
    vector<string>v;
    ll flag=0,flag1=0;
    if(a!=1)
    {
        for(int i=0; i<a-1; i++)
        {
            string d;
            d=c[i];
            reverse(d.begin(),d.end());
            for(int j=i+1; j<a; j++)
            {
                if(j!=i && d==c[j])
                {
                    l.push_back(c[j]);
                    l.push_front(c[i]);
                    flag1=1;
                    break;
                }
                flag1=0;
            }
            if(d==c[i] && flag==0 && flag1==0)
            {
                flag=1;
                v.push_back(d);
            }
        }
    }
    ll sum=l.size();
    if(a==1)
    {
        string d;
        d=c[0];
        reverse(d.begin(),d.end());
        if(d==c[0])
        {
            cout<<++sum*b<<endl<<d<<endl;
            return 0;
        }
    }
    if(flag==1)
    {
        sum++;
    }
    cout<<sum*b<<endl;
    for(int i=0; i<l.size(); i++)
    {
        cout<<l[i];
        if(((sum-1)/2)==i+1)
        {
            cout<<v[0];
        }
    }
    cout<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long llu;
const ll inf = 1e9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const ll MAX = 1e7 + 20;
#define fast ios_base:: sync_with_stdio( false ); cin.tie(0); cout.tie(0);
#define eb              emplace_back
#define em              emplace
#define pb              push_back
#define Mp              make_pair
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define rep(i,n)        for(int i=0;i<n;i++)
#define rep1(i,n)       for(int i=1;i<=n;i++)
#define rrep(i,a,n)     for(int i=a;i<=n;i++)
#define per(i,n,a)      for(int i=n;i>=a;i--)
#define pf(n)           printf("%lld",n)
#define pfi(n)          printf("%d",n)
#define sp              printf(" ")
#define ln              "\n"

#define pi acos(-1.0)
#define mod 1000000007

///Library
#define mem(a,b) memset(a,b,sizeof(a))
#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define SortA(ar,s) sort(ar,ar+s)
#define SortD(ar,s) sort(ar,ar+s,greater<int>())
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sq(x) (x)*(x)

///vector
#define Lower_bound(vec,value) lower_bound(vec.begin(),vec.end(),value)
#define Upper_bound(vec,value) upper_bound(vec.begin(),vec.end(),value)

//template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
//template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
ll x[26];

int main()
{
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/

    fast
    ll a,b;

    cin>>a>>b;
    string c[a];
    for(int i=0; i<a; i++)
    {
        cin>>c[i];
    }
    deque<string>l;
    vector<string>v;
    ll flag=0,flag1=0;
    if(a!=1)
    {
        for(int i=0; i<a; i++)
        {
            string d;
            d=c[i];
            reverse(d.begin(),d.end());
            for(int j=i+1; j<a; j++)
            {
                if(j!=i && d==c[j])
                {
                    l.push_back(c[j]);
                    l.push_front(c[i]);
                    flag1=1;
                    break;
                }
                flag1=0;
            }
            if(d==c[i] && flag==0 && flag1==0)
            {
                flag=1;
                v.push_back(d);
            }
        }
    }
    ll sum=l.size();
    if(a==1)
    {
        string d;
        d=c[0];
        reverse(d.begin(),d.end());
        if(d==c[0])
        {
            cout<<++sum*b<<endl<<d<<endl;
            return 0;
        }
    }
    if(flag==1)
    {
        sum++;
    }
    cout<<sum*b<<endl;
    for(int i=0; i<l.size(); i++)
    {
        cout<<l[i];
        if(((sum-1)/2)==i+1)
        {
            cout<<v[0];
        }
    }
    cout<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long llu;
const ll inf = 1e9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const ll MAX = 1e7 + 20;
#define fast ios_base:: sync_with_stdio( false ); cin.tie(0); cout.tie(0);
#define eb              emplace_back
#define em              emplace
#define pb              push_back
#define Mp              make_pair
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define rep(i,n)        for(int i=0;i<n;i++)
#define rep1(i,n)       for(int i=1;i<=n;i++)
#define rrep(i,a,n)     for(int i=a;i<=n;i++)
#define per(i,n,a)      for(int i=n;i>=a;i--)
#define pf(n)           printf("%lld",n)
#define pfi(n)          printf("%d",n)
#define sp              printf(" ")
#define ln              "\n"

#define pi acos(-1.0)
#define mod 1000000007

///Library
#define mem(a,b) memset(a,b,sizeof(a))
#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define SortA(ar,s) sort(ar,ar+s)
#define SortD(ar,s) sort(ar,ar+s,greater<int>())
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sq(x) (x)*(x)

///vector
#define Lower_bound(vec,value) lower_bound(vec.begin(),vec.end(),value)
#define Upper_bound(vec,value) upper_bound(vec.begin(),vec.end(),value)

//template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
//template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
ll x[26];

int main()
{
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/

    fast
    ll a,b;

    cin>>a>>b;
    string c[a];
    for(int i=0; i<a; i++)
    {
        cin>>c[i];
    }
    deque<string>l;
    vector<string>v;
    set<string>s;
    ll flag=0,flag1=0;
    if(a!=1)
    {
        for(int i=0; i<a; i++)
        {
            string d;
            d=c[i];
            reverse(d.begin(),d.end());
            for(int j=0; j<a; j++)
            {
                if(j!=i && d==c[j] && s.find(d)==s.end() && s.find(c[i])==s.end())
                {
                    l.push_back(c[j]);
                    l.push_front(c[i]);
                    s.insert(c[j]);
                    s.insert(c[i]);
                    flag1=1;
                    break;
                }
                flag1=0;
            }
            if(d==c[i] && flag==0 && flag1==0)
            {
                flag=1;
                v.push_back(d);
            }
        }
    }
    ll sum=l.size();
    if(a==1)
    {
        string d;
        d=c[0];
        reverse(d.begin(),d.end());
        if(d==c[0])
        {
            cout<<++sum*b<<endl<<d<<endl;
            return 0;
        }
    }
    if(flag==1)
    {
        sum++;
    }
    cout<<sum*b<<endl;
    for(int i=0; i<l.size(); i++)
    {
        cout<<l[i];
        if(((sum-1)/2)==i+1)
        {
            cout<<v[0];
        }
    }
    cout<<endl;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <fstream>
#include <cmath>
#include <string>
#include <string.h>
#include <iomanip>
#include <functional>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define SS                            \
    ios_base::sync_with_stdio(false); \
    cin.tie(0)
#define pb push_back
#define endl '\n'
#define palindrome(s) (s == string(s.rbegin(), s.rend()))
#define palindrome2(s1, s2) (s1 == string(s2.rbegin(), s2.rend()))
typedef long long ll;
using namespace std;

int main()
{
    SS;
    int n, l;
    cin >> n >> l;
    vector<string> v;
    vector<string> u;
    string mid = "";
    rep(i, 0, n - 1)
    {
        string s;
        cin >> s;
        v.pb(s);
    }
    rep(i, 0, v.size() - 2)
    {
        rep(j, i + 1, v.size() - 1)
        {
            if (palindrome2(v[i], v[j]))
            {
                u.pb(v[i]);
                u.pb(v[j]);
                v.erase(v.begin() + j);
                v.erase(v.begin() + i);
                i = -1;
                break;
            }
        }
        if (v.size() == 1)
            break;
    }
    rep(i, 0, v.size() - 1)
    {
        if (palindrome(v[i]))
        {
            mid = v[i];
            break;
        }
    }
    int len = l * u.size();
    if (mid != "")
        len += l;
    cout << len << endl;
    for (int i = 0; i < u.size(); i += 2)
    {
        cout << u[i];
    }
    cout << mid;
    for (int i = u.size() - 1; i >= 0; i -= 2)
    {
        cout << u[i];
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <fstream>
#include <cmath>
#include <string>
#include <string.h>
#include <iomanip>
#include <functional>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define SS                            \
    ios_base::sync_with_stdio(false); \
    cin.tie(0)
#define pb push_back
#define endl '\n'
#define palindrome(s) (s == string(s.rbegin(), s.rend()))
#define palindrome2(s1, s2) (s1 == string(s2.rbegin(), s2.rend()))
typedef long long ll;
using namespace std;

int main()
{
    SS;
    int n, l;
    cin >> n >> l;
    vector<string> v;
    vector<string> u;
    string mid = "";
    rep(i, 0, n - 1)
    {
        string s;
        cin >> s;
        v.pb(s);
    }
    rep(i, 0, v.size() - 1)
    {
        rep(j, 0, v.size() - 1)
        {
            if (i == j)
                continue;
            if (palindrome2(v[i], v[j]))
            {
                u.pb(v[i]);
                u.pb(v[j]);
                if (i > j)
                {
                    v.erase(v.begin() + i);
                    v.erase(v.begin() + j);
                }
                else
                {
                    v.erase(v.begin() + j);
                    v.erase(v.begin() + i);
                }
                i = -1;
                j = -1;
            }
        }
    }
    /*
    for (auto itr = v.begin(); itr != v.end(); itr++)
    {
        cout << *itr << endl;
    }
    for (auto itr = u.begin(); itr != u.end(); itr++)
    {
        cout << *itr << endl;
    }
    */
    rep(i, 0, v.size() - 1)
    {
        if (palindrome(v[i]))
        {
            mid = v[i];
            break;
        }
    }
    int len = l * u.size();
    if (mid != "")
        len += l;
    cout << len << endl;
    for (int i = 0; i < u.size(); i += 2)
    {
        cout << u[i];
    }
    cout << mid;
    for (int i = 1; i < u.size(); i += 2)
    {
        cout << u[i];
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <fstream>
#include <cmath>
#include <string>
#include <string.h>
#include <iomanip>
#include <functional>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define SS                            \
    ios_base::sync_with_stdio(false); \
    cin.tie(0)
#define pb push_back
#define endl '\n'
#define palindrome(s) (s == string(s.rbegin(), s.rend()))
#define palindrome2(s1, s2) (s1 == string(s2.rbegin(), s2.rend()))
typedef long long ll;
using namespace std;

int main()
{
    SS;
    int n, l;
    cin >> n >> l;
    vector<string> v;
    vector<string> u;
    string mid = "";
    rep(i, 0, n - 1)
    {
        string s;
        cin >> s;
        v.pb(s);
    }
    rep(i, 0, v.size() - 2)
    {
        rep(j, i + 1, v.size() - 1)
        {
            if (palindrome2(v[i], v[j]))
            {
                u.pb(v[i]);
                u.pb(v[j]);
                v.erase(v.begin() + j);
                v.erase(v.begin() + i);
                i = -1;
                break;
            }
        }
        if (v.size() == 1)
            break;
    }
    /*
    for (auto itr = v.begin(); itr != v.end(); itr++)
    {
        cout << *itr << endl;
    }
    */
    rep(i, 0, v.size() - 1)
    {
        if (palindrome(v[i]))
        {
            mid = v[i];
            break;
        }
    }
    int len = l * u.size();
    if (mid != "")
        len += l;
    cout << len << endl;
    for (int i = 0; i < u.size(); i += 2)
    {
        cout << u[i];
    }
    cout << mid;
    for (int i = u.size() - 1; i >= 0; i -= 2)
    {
        cout << u[i];
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <fstream>
#include <cmath>
#include <string>
#include <string.h>
#include <iomanip>
#include <functional>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define SS                            \
    ios_base::sync_with_stdio(false); \
    cin.tie(0)
#define pb push_back
#define endl '\n'
#define palindrome(s) (s == string(s.rbegin(), s.rend()))
#define palindrome2(s1, s2) (s1 == string(s2.rbegin(), s2.rend()))
typedef long long ll;
using namespace std;

int main()
{
    SS;
    int n, l;
    cin >> n >> l;
    vector<string> v;
    vector<string> u;
    string mid = "";
    rep(i, 0, n - 1)
    {
        string s;
        cin >> s;
        v.pb(s);
    }
    rep(i, 0, v.size() - 1)
    {
        rep(j, 0, v.size() - 1)
        {
            if (i == j)
                continue;
            if (palindrome2(v[i], v[j]))
            {
                u.pb(v[i]);
                u.pb(v[j]);
                if (i > j)
                {
                    v.erase(v.begin() + i);
                    v.erase(v.begin() + j);
                }
                else
                {
                    v.erase(v.begin() + j);
                    v.erase(v.begin() + i);
                }
                i = -1;
                break;
            }
        }
    }
    rep(i, 0, v.size() - 1)
    {
        if (palindrome(v[i]))
        {
            mid = v[i];
            break;
        }
    }
    int len = l * u.size();
    if (mid != "")
        len += l;
    cout << len << endl;
    for (int i = 0; i < u.size(); i += 2)
    {
        cout << u[i];
    }
    cout << mid;
    for (int i = u.size() - 1; i >= 0; i -= 2)
    {
        cout << u[i];
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <fstream>
#include <cmath>
#include <string>
#include <string.h>
#include <iomanip>
#include <functional>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define SS                            \
    ios_base::sync_with_stdio(false); \
    cin.tie(0)
#define pb push_back
#define endl '\n'
#define palindrome(s) (s == string(s.rbegin(), s.rend()))
#define palindrome2(s1, s2) (s1 == string(s2.rbegin(), s2.rend()))
typedef long long ll;
using namespace std;

int main()
{
    SS;
    int n, l;
    cin >> n >> l;
    vector<string> v;
    vector<string> u;
    string mid = "";
    rep(i, 0, n - 1)
    {
        string s;
        cin >> s;
        v.pb(s);
    }
    rep(i, 0, v.size() - 1)
    {
        rep(j, 0, v.size() - 1)
        {
            if (i == j)
                continue;
            if (palindrome2(v[i], v[j]))
            {
                u.pb(v[i]);
                u.pb(v[j]);
                if (i > j)
                {
                    v.erase(v.begin() + i);
                    v.erase(v.begin() + j);
                }
                else
                {
                    v.erase(v.begin() + j);
                    v.erase(v.begin() + i);
                }
                i--;
                j--;
            }
        }
    }
    rep(i, 0, v.size() - 1)
    {
        if (palindrome(v[i]))
        {
            mid = v[i];
            break;
        }
    }
    int len = l * u.size();
    if (mid != "")
        len += l;
    cout << len << endl;
    for (int i = 0; i < u.size(); i += 2)
    {
        cout << u[i];
    }
    cout << mid;
    for (int i = u.size() - 1; i >= 0; i -= 2)
    {
        cout << u[i];
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <fstream>
#include <cmath>
#include <string>
#include <string.h>
#include <iomanip>
#include <functional>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define SS                            \
    ios_base::sync_with_stdio(false); \
    cin.tie(0)
#define pb push_back
#define endl '\n'
#define palindrome(s) (s == string(s.rbegin(), s.rend()))
#define palindrome2(s1, s2) (s1 == string(s2.rbegin(), s2.rend()))
typedef long long ll;
using namespace std;

int main()
{
    SS;
    int n, l;
    cin >> n >> l;
    vector<string> v;
    vector<string> u;
    string mid = "";
    rep(i, 0, n - 1)
    {
        string s;
        cin >> s;
        v.pb(s);
    }
    rep(i, 0, v.size() - 2)
    {
        rep(j, i + 1, v.size() - 1)
        {
            if (palindrome2(v[i], v[j]))
            {
                if(n==100){
                    cout<<j<<endl;
                }
                u.pb(v[i]);
                u.pb(v[j]);
                v.erase(v.begin() + j);
                v.erase(v.begin() + i);
                i = -1;
                break;
            }
        }
        if (v.size() == 1)
            break;
    }
    rep(i, 0, v.size() - 1)
    {
        if (palindrome(v[i]))
        {
            mid = v[i];
            break;
        }
    }
    int len = l * u.size();
    if (mid != "")
        len += l;
    cout << len << endl;
    for (int i = 0; i < u.size(); i += 2)
    {
        cout << u[i];
    }
    cout << mid;
    for (int i = u.size() - 1; i >= 0; i -= 2)
    {
        cout << u[i];
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <fstream>
#include <cmath>
#include <string>
#include <string.h>
#include <iomanip>
#include <functional>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define SS                            \
    ios_base::sync_with_stdio(false); \
    cin.tie(0)
#define pb push_back
#define endl '\n'
#define palindrome(s) (s == string(s.rbegin(), s.rend()))
#define palindrome2(s1, s2) (s1 == string(s2.rbegin(), s2.rend()))
typedef long long ll;
using namespace std;

int main()
{
    SS;
    int n, l;
    cin >> n >> l;
    vector<string> v;
    vector<string> u;
    string mid = "";
    rep(i, 0, n - 1)
    {
        string s;
        cin >> s;
        v.pb(s);
    }
    rep(i, 0, v.size() - 2)
    {
        rep(j, i + 1, v.size() - 1)
        {
            if (palindrome2(v[i], v[j]))
            {
                u.pb(v[i]);
                u.pb(v[j]);
                v.erase(v.begin() + j);
                v.erase(v.begin() + i);
                i--;
                break;
            }
        }
    }
    rep(i, 0, v.size() - 1)
    {
        if (palindrome(v[i]))
        {
            mid = v[i];
            break;
        }
    }
    int len = l * u.size();
    if (mid != "")
        len += l;
    cout << len << endl;
    for (int i = 0; i < u.size(); i += 2)
    {
        cout << u[i];
    }
    cout << mid;
    for (int i = u.size() - 1; i >= 0; i -= 2)
    {
        cout << u[i];
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <fstream>
#include <cmath>
#include <string>
#include <string.h>
#include <iomanip>
#include <functional>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define SS                            \
    ios_base::sync_with_stdio(false); \
    cin.tie(0)
#define pb push_back
#define endl '\n'
#define palindrome(s) (s == string(s.rbegin(), s.rend()))
#define palindrome2(s1, s2) (s1 == string(s2.rbegin(), s2.rend()))
typedef long long ll;
using namespace std;

int main()
{
    SS;
    int n, l;
    cin >> n >> l;
    vector<string> v;
    vector<string> u;
    string mid = "";
    rep(i, 0, n - 1)
    {
        string s;
        cin >> s;
        v.pb(s);
    }
    rep(i, 0, v.size() - 1)
    {
        rep(j, 0, v.size() - 1)
        {
            if (i == j)
                continue;
            if (palindrome2(v[i], v[j]))
            {
                u.pb(v[i]);
                u.pb(v[j]);
                if (i > j)
                {
                    v.erase(v.begin() + i);
                    v.erase(v.begin() + j);
                }
                else
                {
                    v.erase(v.begin() + j);
                    v.erase(v.begin() + i);
                }
                i--;
                break;
            }
        }
    }
    rep(i, 0, v.size() - 1)
    {
        if (palindrome(v[i]))
        {
            mid = v[i];
            break;
        }
    }
    int len = l * u.size();
    if (mid != "")
        len += l;
    cout << len << endl;
    for (int i = 0; i < u.size(); i += 2)
    {
        cout << u[i];
    }
    cout << mid;
    for (int i = u.size() - 1; i >= 0; i -= 2)
    {
        cout << u[i];
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <fstream>
#include <cmath>
#include <string>
#include <string.h>
#include <iomanip>
#include <functional>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define SS                            \
    ios_base::sync_with_stdio(false); \
    cin.tie(0)
#define pb push_back
#define endl '\n'
#define palindrome(s) (s == string(s.rbegin(), s.rend()))
#define palindrome2(s1, s2) (s1 == string(s2.rbegin(), s2.rend()))
typedef long long ll;
using namespace std;

int main()
{
    SS;
    int n, l;
    cin >> n >> l;
    vector<string> v;
    vector<string> u;
    string mid = "";
    rep(i, 0, n - 1)
    {
        string s;
        cin >> s;
        v.pb(s);
    }
    rep(i, 0, v.size() - 1)
    {
        rep(j, 0, v.size() - 1)
        {
            if (i == j)
                continue;
            if (palindrome2(v[i], v[j]))
            {
                u.pb(v[i]);
                u.pb(v[j]);
                if (i > j)
                {
                    v.erase(v.begin() + i);
                    v.erase(v.begin() + j);
                }
                else
                {
                    v.erase(v.begin() + j);
                    v.erase(v.begin() + i);
                }
                i = -1;
                j = -1;
            }
        }
    }
    /*
    for (auto itr = v.begin(); itr != v.end(); itr++)
    {
        cout << *itr << endl;
    }
    for (auto itr = u.begin(); itr != u.end(); itr++)
    {
        cout << *itr << endl;
    }
    */
    rep(i, 0, v.size() - 1)
    {
        if (palindrome(v[i]))
        {
            mid = v[i];
            break;
        }
    }
    int len = l * u.size();
    if (mid != "")
        len += l;
    cout << len << endl;
    for (int i = 0; i < u.size(); i += 2)
    {
        cout << u[i];
    }
    cout << mid;
    for (int i = u.size() - 1; i >= 0; i -= 2)
    {
        cout << u[i];
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <fstream>
#include <cmath>
#include <string>
#include <string.h>
#include <iomanip>
#include <functional>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define SS                            \
    ios_base::sync_with_stdio(false); \
    cin.tie(0)
#define pb push_back
#define endl '\n'
#define palindrome(s) (s == string(s.rbegin(), s.rend()))
#define palindrome2(s1, s2) (s1 == string(s2.rbegin(), s2.rend()))
typedef long long ll;
using namespace std;

int main()
{
    SS;
    int n, l;
    cin >> n >> l;
    vector<string> v;
    vector<string> u;
    string mid = "";
    rep(i, 0, n - 1)
    {
        string s;
        cin >> s;
        v.pb(s);
    }
    rep(i, 0, v.size() - 2)
    {
        rep(j, i + 1, v.size() - 1)
        {
            if (palindrome2(v[i], v[j]))
            {
                u.pb(v[i]);
                u.pb(v[j]);
                v.erase(v.begin() + j);
                v.erase(v.begin() + i);
                i--;
                break;
            }
        }
        if (v.size() == 1)
            break;
    }
    rep(i, 0, v.size() - 1)
    {
        if (palindrome(v[i]))
        {
            mid = v[i];
            break;
        }
    }
    int len = l * u.size();
    if (mid != "")
        len += l;
    cout << len << endl;
    for (int i = 0; i < u.size(); i += 2)
    {
        cout << u[i];
    }
    cout << mid;
    for (int i = u.size() - 1; i >= 0; i -= 2)
    {
        cout << u[i];
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <fstream>
#include <cmath>
#include <string>
#include <string.h>
#include <iomanip>
#include <functional>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define SS                            \
    ios_base::sync_with_stdio(false); \
    cin.tie(0)
#define pb push_back
#define endl '\n'
#define palindrome(s) (s == string(s.rbegin(), s.rend()))
#define palindrome2(s1, s2) (s1 == string(s2.rbegin(), s2.rend()))
typedef long long ll;
using namespace std;

int main()
{
    SS;
    int n, l;
    cin >> n >> l;
    vector<string> v;
    vector<string> u;
    string mid = "";
    rep(i, 0, n - 1)
    {
        string s;
        cin >> s;
        v.pb(s);
    }
    rep(i, 0, v.size() - 1)
    {
        rep(j, i, v.size() - 1)
        {
            if (i == j)
                continue;
            if (palindrome2(v[i], v[j]))
            {
                u.pb(v[i]);
                u.pb(v[j]);
                if (i > j)
                {
                    v.erase(v.begin() + i);
                    v.erase(v.begin() + j);
                    i-=2;
                }
                else
                {
                    v.erase(v.begin() + j);
                    v.erase(v.begin() + i);
                    i--;
                }
                break;
            }
        }
    }
    rep(i, 0, v.size() - 1)
    {
        if (palindrome(v[i]))
        {
            mid = v[i];
            break;
        }
    }
    int len = l * u.size();
    if (mid != "")
        len += l;
    cout << len << endl;
    for (int i = 0; i < u.size(); i += 2)
    {
        cout << u[i];
    }
    cout << mid;
    for (int i = u.size() - 1; i >= 0; i -= 2)
    {
        cout << u[i];
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <fstream>
#include <cmath>
#include <string>
#include <string.h>
#include <iomanip>
#include <functional>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define SS                            \
    ios_base::sync_with_stdio(false); \
    cin.tie(0)
#define pb push_back
#define endl '\n'
#define palindrome(s) (s == string(s.rbegin(), s.rend()))
#define palindrome2(s1, s2) (s1 == string(s2.rbegin(), s2.rend()))
typedef long long ll;
using namespace std;

int main()
{
    SS;
    int n, l;
    cin >> n >> l;
    vector<string> v;
    vector<string> u;
    string mid = "";
    rep(i, 0, n - 1)
    {
        string s;
        cin >> s;
        v.pb(s);
    }
    rep(i, 0, v.size() - 1)
    {
        rep(j, i, v.size() - 1)
        {
            if (i == j)
                continue;
            if (palindrome2(v[i], v[j]))
            {
                u.pb(v[i]);
                u.pb(v[j]);
                if (i > j)
                {
                    v.erase(v.begin() + i);
                    v.erase(v.begin() + j);
                }
                else
                {
                    v.erase(v.begin() + j);
                    v.erase(v.begin() + i);
                }
                i--;
                break;
            }
        }
    }
    rep(i, 0, v.size() - 1)
    {
        if (palindrome(v[i]))
        {
            mid = v[i];
            break;
        }
    }
    int len = l * u.size();
    if (mid != "")
        len += l;
    cout << len << endl;
    for (int i = 0; i < u.size(); i += 2)
    {
        cout << u[i];
    }
    cout << mid;
    for (int i = u.size() - 1; i >= 0; i -= 2)
    {
        cout << u[i];
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <fstream>
#include <cmath>
#include <string>
#include <string.h>
#include <iomanip>
#include <functional>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define SS                            \
    ios_base::sync_with_stdio(false); \
    cin.tie(0)
#define pb push_back
#define endl '\n'
#define palindrome(s) (s == string(s.rbegin(), s.rend()))
#define palindrome2(s1, s2) (s1 == string(s2.rbegin(), s2.rend()))
typedef long long ll;
using namespace std;

int main()
{
    SS;
    int n, l;
    cin >> n >> l;
    vector<string> v;
    vector<string> u;
    string mid = "";
    rep(i, 0, n - 1)
    {
        string s;
        cin >> s;
        v.pb(s);
    }
    rep(i, 0, v.size() - 1)
    {
        rep(j, i + 1, v.size() - 1)
        {
            if (palindrome2(v[i], v[j]))
            {
                u.pb(v[i]);
                u.pb(v[j]);
                v.erase(v.begin() + j);
                v.erase(v.begin() + i);
                i--;
                break;
            }
        }
    }
    rep(i, 0, v.size() - 1)
    {
        if (palindrome(v[i]))
        {
            mid = v[i];
            break;
        }
    }
    int len = l * u.size();
    if (mid != "")
        len += l;
    cout << len << endl;
    for (int i = 0; i < u.size(); i += 2)
    {
        cout << u[i];
    }
    cout << mid;
    for (int i = u.size() - 1; i >= 0; i -= 2)
    {
        cout << u[i];
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <fstream>
#include <cmath>
#include <string>
#include <string.h>
#include <iomanip>
#include <functional>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define SS                            \
    ios_base::sync_with_stdio(false); \
    cin.tie(0)
#define pb push_back
#define endl '\n'
#define palindrome(s) (s == string(s.rbegin(), s.rend()))
#define palindrome2(s1, s2) (s1 == string(s2.rbegin(), s2.rend()))
typedef long long ll;
using namespace std;

int main()
{
    SS;
    int n, l;
    cin >> n >> l;
    vector<string> v;
    vector<string> u;
    string mid = "";
    rep(i, 0, n - 1)
    {
        string s;
        cin >> s;
        v.pb(s);
    }
    rep(i, 0, v.size() - 2)
    {
        rep(j, i + 1, v.size() - 1)
        {
            if (palindrome2(v[i], v[j]))
            {
                u.pb(v[i]);
                u.pb(v[j]);
                v.erase(v.begin() + i);
                i = -1;
                break;
            }
        }
        if (v.size() == 1)
            break;
    }
    /*
    for (auto itr = v.begin(); itr != v.end(); itr++)
    {
        cout << *itr << endl;
    }
    */
    rep(i, 0, v.size() - 1)
    {
        if (palindrome(v[i]))
        {
            mid = v[i];
            break;
        }
    }
    int len = l * u.size();
    if (mid != "")
        len += l;
    cout << len << endl;
    for (int i = 0; i < u.size(); i += 2)
    {
        cout << u[i];
    }
    cout << mid;
    for (int i = u.size() - 1; i >= 0; i -= 2)
    {
        cout << u[i];
    }
    cout << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define llu unsigned long long int
#define scll(x) scanf("%lld",&x)
#define scld(x) scanf("%lf",&x)
#define scull(x) scanf("%llu",&x)
#define scch(x) scanf(" %c",&ch)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define ppb(x) pop_back(x)
#define ppf(x) pop_front(x)
#define Pi acos(-1.0)
ll  _xor(ll a,ll b){return a^b;}
ll _and(ll a,ll b){return a&b;}
ll _or(ll a,ll b){return a|b;}
ll _not(ll a){ return ~a;}
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll ai[1000],pi[2005];
int main()
{
           #ifndef ONLINE_JUDGE
         freopen("input.txt","r",stdin);
         freopen("output.txt","w",stdout);
         #endif

    ll b,c=0,x,y,z,t,i,j,k,l1,l2,m,n,c1=0,c2=0,q,poisa,f=0;

scll(n);
scll(m);
string str[n],str2;
for(j=0;j<n;j++)
{
	cin>>str[j];
}
vector<string>vec1;
vector<string>vec2,vec3;
for(j=0;j<n;j++)
{
	if(str[j]!="1")
	{
	for(i=0;i<n;i++)
	{
		if(str[i]!="1"&&i!=j)
		{
			string str1=str[j];
                reverse(str1.begin(),str1.end());
			if(str[i]==str1)
               {
               	vec1.pb(str[j]);
               	vec2.pb(str[i]);
               	str[i]="1";
               	str[j]="1";
               	c=1;
               	break;
               }
		}
	}
	if(c==0)
	{
             str2=str[j];
             reverse(str2.begin(),str2.end());
             if(str2==str[j])
             	{vec3.pb(str[j]);
                 str[j]="1";
             	}

	}
	c=0;
}

}
if(vec1.size()+vec2.size()+vec3.size()==0)
	cout<<0;
else{
for(j=0;j<vec1.size();j++)
{
  c1+=vec1[j].size();
}
for(j=0;j<vec2.size();j++)
{
  c1+=vec2[j].size();
}
for(j=0;j<vec3.size();j++)
{
  c1+=vec3[j].size();
}

cout<<c1<<"\n";
for(j=0;j<vec1.size();j++)
cout<<vec1[j];
if(vec3.size()>0){
cout<<vec3[0];
for(j=1;j<vec3.size();j++)
{
        if(vec3[0]==vec3[j])
	cout<<vec3[j];
}
}
for(j=vec2.size()-1;j>=0;j--)
cout<<vec2[j];
}

return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define llu unsigned long long int
#define scll(x) scanf("%lld",&x)
#define scld(x) scanf("%lf",&x)
#define scull(x) scanf("%llu",&x)
#define scch(x) scanf(" %c",&ch)
#define pf(x) push_front(x)
#define ppb(x) pop_back(x)
#define ppf(x) pop_front(x)
#define Pi acos(-1.0)
ll  _xor(ll a,ll b){return a^b;}
ll _and(ll a,ll b){return a&b;}
ll _or(ll a,ll b){return a|b;}
ll _not(ll a){ return ~a;}
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll ai[1000],pi[2005];
int main()
{
           #ifndef ONLINE_JUDGE
         freopen("input.txt","r",stdin);
         freopen("output.txt","w",stdout);
         #endif

    ll b,c=0,x,y,z,t,i,j,k,l1,l2,m,n,c1=0,c2=0,q,poisa,f=0;

scll(n);
scll(m);
string str[n],str2,str3;
for(j=0;j<n;j++)
{
	cin>>str[j];
}
vector<string>vec1;
vector<string>vec2;
for(j=0;j<n;j++)
{
	if(str[j]!="1")
	{
	for(i=0;i<n;i++)
	{
		if(str[i]!="1"&&i!=j)
		{
			string str1=str[j];
                reverse(str1.begin(),str1.end());
			if(str[i]==str1)
               {
               	vec1.push_back(str[j]);
               	vec2.push_back(str[i]);
               	str[i]="1";
               	str[j]="1";
               	break;
               }
		}
	}
}

}
for(j=0;j<n;j++)
{
	if(str[j]!="1")
	{
		str2=str[j];
		 reverse(str2.begin(),str2.end());
		if(str[j]==str2)
		{
                         str3=str[j];
                          c=1;
		         break;
                  //cout<<str[j]<<"\n";
		}

	}
}
if(((vec1.size()+vec2.size())==0)&&c==0)
	cout<<0;
else if(c==1&&vec1.size()+vec2.size()==0)
cout<<str3;
else{

for(j=0;j<vec1.size();j++)
{
  c1+=vec1[j].size();
}

for(j=0;j<vec2.size();j++)
{
  c1+=vec2[j].size();
}
if(c==1)
c1+=m;

cout<<c1<<"\n";
for(j=0;j<vec1.size();j++)
cout<<vec1[j];
if(c==1){
cout<<str3;
}
if(vec2.size()>0){
for(j=vec2.size()-1;j>=0;j--)
cout<<vec2[j];
}
}
//cout<<vec1.size();
//cout<<vec2.size();

return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define llu unsigned long long int
#define scll(x) scanf("%lld",&x)
#define scld(x) scanf("%lf",&x)
#define scull(x) scanf("%llu",&x)
#define scch(x) scanf(" %c",&ch)
#define pf(x) push_front(x)
#define ppb(x) pop_back(x)
#define ppf(x) pop_front(x)
#define Pi acos(-1.0)
ll  _xor(ll a,ll b){return a^b;}
ll _and(ll a,ll b){return a&b;}
ll _or(ll a,ll b){return a|b;}
ll _not(ll a){ return ~a;}
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll ai[1000],pi[2005];
int main()
{
           #ifndef ONLINE_JUDGE
         freopen("input.txt","r",stdin);
         freopen("output.txt","w",stdout);
         #endif

    ll b,c=0,x,y,z,t,i,j,k,l1,l2,m,n,c1=0,c2=0,q,poisa,f=0;

scll(n);
scll(m);
string str[n],str2,str3;
for(j=0;j<n;j++)
{
	cin>>str[j];
}
vector<string>vec1;
vector<string>vec2;
for(j=0;j<n;j++)
{
	if(str[j]!="1")
	{
	for(i=0;i<n;i++)
	{
		if(str[i]!="1"&&i!=j)
		{
			string str1=str[j];
                reverse(str1.begin(),str1.end());
			if(str[i]==str1)
               {
               	vec1.push_back(str[j]);
               	vec2.push_back(str[i]);
               	str[i]="1";
               	str[j]="1";
               	break;
               }
		}
	}
}

}
for(j=0;j<n;j++)
{
	if(str[j]!="1")
	{
		str2=str[j];
		 reverse(str2.begin(),str2.end());
		if(str[j]==str2)
		{
                         str3=str[j];
                          c=1;
		         break;
                  //cout<<str[j]<<"\n";
		}

	}
}
if(((vec1.size()+vec2.size())==0)&&c==0)
	cout<<0;
else{

for(j=0;j<vec1.size();j++)
{
  c1+=vec1[j].size();
}

for(j=0;j<vec2.size();j++)
{
  c1+=vec2[j].size();
}
if(c==1)
c1+=m;
cout<<c1<<"\n";
for(j=0;j<vec1.size();j++)
cout<<vec1[j];
if(c==1){
cout<<str3;
}
if(vec2.size()>0){
for(j=vec2.size()-1;j>=0;j--)
cout<<vec2[j];
}
}
//cout<<vec1.size();
//cout<<vec2.size();

return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define llu unsigned long long int
#define scll(x) scanf("%lld",&x)
#define scld(x) scanf("%lf",&x)
#define scull(x) scanf("%llu",&x)
#define scch(x) scanf(" %c",&ch)
#define pf(x) push_front(x)
#define ppb(x) pop_back(x)
#define ppf(x) pop_front(x)
#define Pi acos(-1.0)
ll  _xor(ll a,ll b){return a^b;}
ll _and(ll a,ll b){return a&b;}
ll _or(ll a,ll b){return a|b;}
ll _not(ll a){ return ~a;}
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll ai[1000],pi[2005];
int main()
{
           #ifndef ONLINE_JUDGE
         freopen("input.txt","r",stdin);
         freopen("output.txt","w",stdout);
         #endif

    ll b,c=0,x,y,z,t,i,j,k,l1,l2,m,n,c1=0,c2=0,q,poisa,f=0;

scll(n);
scll(m);
string str[n],str2,str3;
for(j=0;j<n;j++)
{
	cin>>str[j];
}
vector<string>vec1;
vector<string>vec2;
for(j=0;j<n;j++)
{
	if(str[j]!="1")
	{
	for(i=0;i<n;i++)
	{
		if(str[i]!="1"&&i!=j)
		{
			string str1=str[j];
                reverse(str1.begin(),str1.end());
			if(str[i]==str1)
               {
               	vec1.push_back(str[j]);
               	vec2.push_back(str[i]);
               	str[i]="1";
               	str[j]="1";
               	break;
               }
		}
	}
}

}
for(j=0;j<n;j++)
{
	if(str[j]!="1")
	{
		str2=str[j];
		 reverse(str2.begin(),str2.end());
		if(str[j]==str2)
		{
                         str3=str[j];
                          c=1;
		         break;
                  //cout<<str[j]<<"\n";
		}

	}
}
if(((vec1.size()+vec2.size())==0)&&c==0)
	cout<<0;
else if(c==1&&vec1.size()+vec2.size()==0)
cout<<str3;
else{

for(j=0;j<vec1.size();j++)
{
  c1+=vec1[j].size();
}

for(j=0;j<vec2.size();j++)
{
  c1+=vec2[j].size();
}
if(c==1)
c1+=m;

cout<<c1<<"\n";
for(j=0;j<vec1.size();j++)
cout<<vec1[j];
if(c==1){
cout<<str3;
}
for(j=vec2.size()-1;j>=0;j--)
cout<<vec2[j];
}
//cout<<vec1.size();
//cout<<vec2.size();

return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define llu unsigned long long int
#define scll(x) scanf("%lld",&x)
#define scld(x) scanf("%lf",&x)
#define scull(x) scanf("%llu",&x)
#define scch(x) scanf(" %c",&ch)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define ppb(x) pop_back(x)
#define ppf(x) pop_front(x)
#define Pi acos(-1.0)
ll  _xor(ll a,ll b){return a^b;}
ll _and(ll a,ll b){return a&b;}
ll _or(ll a,ll b){return a|b;}
ll _not(ll a){ return ~a;}
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll ai[1000],pi[2005];
int main()
{
           #ifndef ONLINE_JUDGE
         freopen("input.txt","r",stdin);
         freopen("output.txt","w",stdout);
         #endif

    ll b,c=0,x,y,z,t,i,j,k,l1,l2,m,n,c1=0,c2=0,q,poisa,f=0;

scll(n);
scll(m);
string str[n],str3,strx="";
for(j=0;j<n;j++)
{
	cin>>str[j];
}
vector<string>vec1;
vector<string>vec2;
for(j=0;j<n;j++)
{
	if(str[j]!="1")
	{
	for(i=0;i<n;i++)
	{
		if(str[i]!="1"&&i!=j)
		{
			string str1=str[j];
                reverse(str1.begin(),str1.end());
			if(str[i]==str1)
               {
               	vec1.pb(str[j]);
               	vec2.pb(str[i]);
               	str[i]="1";
               	str[j]="1";
               	break;
               }
		}
	}
}

}
for(j=0;j<n;j++)
{
	if(str[j]!="1")
	{
		string str2=str[j];
		 reverse(str2.begin(),str2.end());
		if(str[j]==str2)
		{
			c1+=str2.size();
			str3=str[j];
			c=1;
			break;
		}

	}
}

for(j=0;j<vec1.size();j++)
{
  strx+=vec1[j];
}
if(c==1){
strx+=str3;
}
for(j=vec2.size()-1;j>=0;j--)
{
  strx+=vec2[j];
}

cout<<strx.size()<<"\n";
cout<<strx;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define llu unsigned long long int
#define scll(x) scanf("%lld",&x)
#define scld(x) scanf("%lf",&x)
#define scull(x) scanf("%llu",&x)
#define scch(x) scanf(" %c",&ch)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define ppb(x) pop_back(x)
#define ppf(x) pop_front(x)
#define Pi acos(-1.0)
ll  _xor(ll a,ll b){return a^b;}
ll _and(ll a,ll b){return a&b;}
ll _or(ll a,ll b){return a|b;}
ll _not(ll a){ return ~a;}
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll ai[1000],pi[2005];
int main()
{
           #ifndef ONLINE_JUDGE
         freopen("input.txt","r",stdin);
         freopen("output.txt","w",stdout);
         #endif

    ll b,c=0,x,y,z,t,i,j,k,l1,l2,m,n,c1=0,c2=0,q,poisa,f=0;

scll(n);
scll(m);
string str[n],str2,str3;
for(j=0;j<n;j++)
{
	cin>>str[j];
}
vector<string>vec1;
vector<string>vec2;
for(j=0;j<n;j++)
{
	if(str[j]!="1")
	{
	for(i=0;i<n;i++)
	{
		if(str[i]!="1"&&i!=j)
		{
			string str1=str[j];
                reverse(str1.begin(),str1.end());
			if(str[i]==str1)
               {
               	vec1.pb(str[j]);
               	vec2.pb(str[i]);
               	str[i]="1";
               	str[j]="1";
               	break;
               }
		}
	}
}

}
for(j=0;j<n;j++)
{
	if(str[j]!="1")
	{
		str2=str[j];
		 reverse(str2.begin(),str2.end());
		if(str[j]==str2)
		{
			c1+=str2.size();
                         str3=str[j];
			c=1;
			break;
		}

	}
}
if(((vec1.size()+vec2.size())==0)&&c==0)
	cout<<0;
else{

for(j=0;j<vec1.size();j++)
{
  c1+=vec1[j].size();
}

for(j=0;j<vec2.size();j++)
{
  c1+=vec2[j].size();
}

cout<<c1<<"\n";
for(j=0;j<vec1.size();j++)
cout<<vec1[j];
if(c==1){
cout<<str3;
}
for(j=vec2.size()-1;j>=0;j--)
cout<<vec2[j];
}
//cout<<vec1.size();
//cout<<vec2.size();

return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define llu unsigned long long int
#define scll(x) scanf("%lld",&x)
#define scld(x) scanf("%lf",&x)
#define scull(x) scanf("%llu",&x)
#define scch(x) scanf(" %c",&ch)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define ppb(x) pop_back(x)
#define ppf(x) pop_front(x)
#define Pi acos(-1.0)
ll  _xor(ll a,ll b){return a^b;}
ll _and(ll a,ll b){return a&b;}
ll _or(ll a,ll b){return a|b;}
ll _not(ll a){ return ~a;}
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll ai[1000],pi[2005];
int main()
{
           #ifndef ONLINE_JUDGE
         freopen("input.txt","r",stdin);
         freopen("output.txt","w",stdout);
         #endif

    ll b,c=0,x,y,z,t,i,j,k,l1,l2,m,n,c1=0,c2=0,q,poisa,f=0;

scll(n);
scll(m);
string str[n],str3,strx="";
for(j=0;j<n;j++)
{
	cin>>str[j];
}
vector<string>vec1;
vector<string>vec2;
for(j=0;j<n;j++)
{
	if(str[j]!="1")
	{
	for(i=0;i<n;i++)
	{
		if(str[i]!="1"&&i!=j)
		{
			string str1=str[j];
                reverse(str1.begin(),str1.end());
			if(str[i]==str1)
               {
               	vec1.pb(str[j]);
               	vec2.pb(str[i]);
               	str[i]="1";
               	str[j]="1";
               	break;
               }
		}
	}
}

}
for(j=0;j<n;j++)
{
	if(str[j]!="1")
	{
		string str2=str[j];
		 reverse(str2.begin(),str2.end());
		if(str[j]==str2)
		{
			c1+=str2.size();
			str3=str[j];
			c=1;
			break;
		}

	}
}

for(j=0;j<vec1.size();j++)
{
  strx+=vec1[j];
}
if(c==1){
strx+=str3;
}
for(j=0;j<vec2.size();j++)
{
  strx+=vec2[j];
}

cout<<strx.size()<<"\n";
cout<<strx;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define llu unsigned long long int
#define scll(x) scanf("%lld",&x)
#define scld(x) scanf("%lf",&x)
#define scull(x) scanf("%llu",&x)
#define scch(x) scanf(" %c",&ch)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define ppb(x) pop_back(x)
#define ppf(x) pop_front(x)
#define Pi acos(-1.0)
ll  _xor(ll a,ll b){return a^b;}
ll _and(ll a,ll b){return a&b;}
ll _or(ll a,ll b){return a|b;}
ll _not(ll a){ return ~a;}
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll ai[1000],pi[2005];
int main()
{
           #ifndef ONLINE_JUDGE
         freopen("input.txt","r",stdin);
         freopen("output.txt","w",stdout);
         #endif

    ll b,c=0,x,y,z,t,i,j,k,l1,l2,m,n,c1=0,c2=0,q,poisa,f=0;

scll(n);
scll(m);
string str[n],str2;
for(j=0;j<n;j++)
{
	cin>>str[j];
}
vector<string>vec1;
vector<string>vec2,vec3;
for(j=0;j<n;j++)
{
	if(str[j]!="1")
	{
	for(i=0;i<n;i++)
	{
		if(str[i]!="1"&&i!=j)
		{
			string str1=str[j];
                reverse(str1.begin(),str1.end());
			if(str[i]==str1)
               {
               	vec1.pb(str[j]);
               	vec2.pb(str[i]);
               	str[i]="1";
               	str[j]="1";
               	c=1;
               	break;
               }
		}
	}
	if(c==0)
	{
             str2=str[j];
             reverse(str2.begin(),str2.end());
             if(str2==str[j])
             	{vec3.pb(str[j]);
                 str[j]="1";
             	}

	}
	c=0;
}

}
if(vec1.size()+vec2.size()+vec3.size()==0)
	cout<<0;
else{
for(j=0;j<vec1.size();j++)
{
  c1+=vec1[j].size();
}
for(j=0;j<vec1.size();j++)
{
  c1+=vec2[j].size();
}
if(vec3.size()>0){
for(j=0;j<vec3.size();j++)
{
  c1+=vec3[j].size();
}
}
cout<<c1<<"\n";
for(j=0;j<vec1.size();j++)
cout<<vec1[j];
if(vec3.size()>0){
cout<<vec3[0];
for(j=1;j<vec3.size();j++)
{
        if(vec3[0]==vec3[j])
	cout<<vec3[j];
}
}
for(j=vec2.size()-1;j>=0;j--)
cout<<vec2[j];
}

return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define llu unsigned long long int
#define scll(x) scanf("%lld",&x)
#define scld(x) scanf("%lf",&x)
#define scull(x) scanf("%llu",&x)
#define scch(x) scanf(" %c",&ch)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define ppb(x) pop_back(x)
#define ppf(x) pop_front(x)
#define Pi acos(-1.0)
ll  _xor(ll a,ll b){return a^b;}
ll _and(ll a,ll b){return a&b;}
ll _or(ll a,ll b){return a|b;}
ll _not(ll a){ return ~a;}
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll ai[1000],pi[2005];
int main()
{
           #ifndef ONLINE_JUDGE
         freopen("input.txt","r",stdin);
         freopen("output.txt","w",stdout);
         #endif

    ll b,c=0,x,y,z,t,i,j,k,l1,l2,m,n,c1=0,c2=0,q,poisa,f=0;

scll(n);
scll(m);
string str[n],str2;
for(j=0;j<n;j++)
{
	cin>>str[j];
}
vector<string>vec1;
vector<string>vec2,vec3;
for(j=0;j<n;j++)
{
	if(str[j]!="1")
	{
	for(i=0;i<n;i++)
	{
		if(str[i]!="1"&&i!=j)
		{
			string str1=str[j];
                reverse(str1.begin(),str1.end());
			if(str[i]==str1)
               {
               	vec1.pb(str[j]);
               	vec2.pb(str[i]);
               	str[i]="1";
               	str[j]="1";

               	break;
               }
		}
	}
}

}
str2="";
for(j=0;j<n;j++)
{
	if(str[j]!="1")
	{
		str2=str[j];
		 reverse(str2.begin(),str2.end());
		if(str[j]==str2)
		{
			c1+=str2.size();
			str2=str[j];
			c=1;
			break;
		}

	}
}
if(vec1.size()+vec2.size()==0)
	cout<<0;
else{
for(j=0;j<vec1.size();j++)
{
  c1+=vec1[j].size();
}
for(j=0;j<vec2.size();j++)
{
  c1+=vec2[j].size();
}

cout<<c1<<"\n";
for(j=0;j<vec1.size();j++)
cout<<vec1[j];
if(c==1){
cout<<str2;
}
for(j=vec2.size()-1;j>=0;j--)
cout<<vec2[j];
}

return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define llu unsigned long long int
#define scll(x) scanf("%lld",&x)
#define scld(x) scanf("%lf",&x)
#define scull(x) scanf("%llu",&x)
#define scch(x) scanf(" %c",&ch)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define ppb(x) pop_back(x)
#define ppf(x) pop_front(x)
#define Pi acos(-1.0)
ll  _xor(ll a,ll b){return a^b;}
ll _and(ll a,ll b){return a&b;}
ll _or(ll a,ll b){return a|b;}
ll _not(ll a){ return ~a;}
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll ai[1000],pi[2005];
int main()
{
           #ifndef ONLINE_JUDGE
         freopen("input.txt","r",stdin);
         freopen("output.txt","w",stdout);
         #endif

    ll b,c=0,x,y,z,t,i,j,k,l1,l2,m,n,c1=0,c2=0,q,poisa,f=0;

scll(n);
scll(m);
string str[n],str3,strx="";
for(j=0;j<n;j++)
{
	cin>>str[j];
}
vector<string>vec1;
vector<string>vec2;
for(j=0;j<n;j++)
{
	if(str[j]!="1")
	{
	for(i=0;i<n;i++)
	{
		if(str[i]!="1"&&i!=j)
		{
			string str1=str[j];
                reverse(str1.begin(),str1.end());
			if(str[i]==str1)
               {
               	vec1.pb(str[j]);
               	vec2.pb(str[i]);
               	str[i]="1";
               	str[j]="1";
               	break;
               }
		}
	}
}

}
for(j=0;j<n;j++)
{
	if(str[j]!="1")
	{
		string str2=str[j];
		 reverse(str2.begin(),str2.end());
		if(str[j]==str2)
		{
			c1+=str2.size();
			str3=str[j];
			c=1;
			break;
		}

	}
}

for(j=0;j<vec1.size();j++)
{
  strx+=vec1[j];
}
if(c==1){
strx+=str3;
}
if(vec2.size()>0){
for(j=vec2.size()-1;j>=0;j--)
{
  strx+=vec2[j];
}
}
cout<<strx.size()<<"\n";
cout<<strx;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define llu unsigned long long int
#define scll(x) scanf("%lld",&x)
#define scld(x) scanf("%lf",&x)
#define scull(x) scanf("%llu",&x)
#define scch(x) scanf(" %c",&ch)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define ppb(x) pop_back(x)
#define ppf(x) pop_front(x)
#define Pi acos(-1.0)
ll  _xor(ll a,ll b){return a^b;}
ll _and(ll a,ll b){return a&b;}
ll _or(ll a,ll b){return a|b;}
ll _not(ll a){ return ~a;}
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll ai[1000],pi[2005];
int main()
{
           #ifndef ONLINE_JUDGE
         freopen("input.txt","r",stdin);
         freopen("output.txt","w",stdout);
         #endif

    ll b,c=0,x,y,z,t,i,j,k,l1,l2,m,n,c1=0,c2=0,q,poisa,f=0;

scll(n);
scll(m);
string str[n],str2;
for(j=0;j<n;j++)
{
	cin>>str[j];
}
vector<string>vec1;
vector<string>vec2,vec3;
for(j=0;j<n;j++)
{
	if(str[j]!="1")
	{
	for(i=0;i<n;i++)
	{
		if(str[i]!="1"&&i!=j)
		{
			string str1=str[j];
                reverse(str1.begin(),str1.end());
			if(str[i]==str1)
               {
               	vec1.pb(str[j]);
               	vec2.pb(str[i]);
               	str[i]="1";
               	str[j]="1";
               	c=1;
               	break;
               }
		}
	}
}

}
str2="";
for(j=0;j<n;j++)
{
	if(str[j]!="1")
	{
		str2=str[j];
		 reverse(str2.begin(),str2.end());
		if(str[j]==str2)
		{
			c1+=str2.size();
			str2=str[j];
			break;
		}

	}
}
if(vec1.size()+vec2.size()==0)
	cout<<0;
else{
for(j=0;j<vec1.size();j++)
{
  c1+=vec1[j].size();
}
for(j=0;j<vec2.size();j++)
{
  c1+=vec2[j].size();
}

cout<<c1<<"\n";
for(j=0;j<vec1.size();j++)
cout<<vec1[j];
if(str2.size()>0){
cout<<str2;
}
for(j=vec2.size()-1;j>=0;j--)
cout<<vec2[j];
}

return 0;
}


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

int main()
{
    int n, m;
    cin >> n >> m;
    string v[100];
    vector<string> left, right;
    string middle;

    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
    }

    for (int i = 0; i < n; i++)
    {
        string t = v[i];
        reverse(t.begin(), t.end());
        if (t == v[i])
        {
            middle = t;
        }
        else
        {
            for (int j = 0; j < n; j++)
            {
                if (j != i)
                {
                    string temp = v[i];
                    string x = v[j];
                    reverse(x.begin(), x.end());
                    if (temp == x && find(left.begin(), left.end(), temp) == left.end() && find(right.begin(), right.end(), x) == right.end())
                    {
                        left.push_back(v[i]);
                        right.push_back(v[j]);
                        break;
                    }
                }
            }
        }
    }
    cout << (left.size() + right.size()) * m + middle.size() << endl;
    for (string x : left)
        cout << x;
    cout << middle;
    reverse(right.begin(), right.end());
    for (string x : right)
        cout << x;
    if (left.empty())
    {
        cout << " " << endl;
    }
    return 0;
}


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

int main()
{
    int n, m;
    cin >> n >> m;
    string v[100];
    vector<string> left, right;
    string middle;

    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
    }

    for (int i = 0; i < n; i++)
    {
        string t = v[i];
        reverse(t.begin(), t.end());
        if (t == v[i])
        {
            middle = t;
        }
        else
        {
            for (int j = 0; j < n; j++)
            {
                if (j != i)
                {
                    string temp = v[i];
                    string x = v[j];
                    reverse(x.begin(), x.end());
                    if (temp == x && find(left.begin(), left.end(), temp) == left.end() && find(right.begin(), right.end(), x) == right.end())
                    {
                        left.push_back(v[i]);
                        right.push_back(v[j]);
                        break;
                    }
                }
            }
        }
    }
    for (string x : left)
        cout << x;
    cout << middle;
    for (string x : right)
        cout << x;

    if (left.empty())
    {
        cout << 0;
    }
    return 0;
}


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

int main()
{
    int n, m;
    cin >> n >> m;
    string v[100];
    vector<string> left, right;
    string middle;

    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
    }

    for (int i = 0; i < n; i++)
    {
        string t = v[i];
        reverse(t.begin(), t.end());
        if (t == v[i])
        {
            middle = t;
        }
        else
        {
            for (int j = 0; j < n; j++)
            {
                if (j != i)
                {
                    string temp = v[i];
                    string x = v[j];
                    reverse(x.begin(), x.end());
                    if (temp == x && find(left.begin(), left.end(), temp) == left.end() && find(right.begin(), right.end(), x) == right.end())
                    {
                        left.push_back(v[i]);
                        right.push_back(v[j]);
                        break;
                    }
                }
            }
        }
    }
    cout << (left.size() + right.size()) * m + middle.size() << endl;
    for (string x : left)
        cout << x;
    cout << middle;
    for (string x : right)
        cout << x;

    if (left.empty())
    {
        cout << " " << endl;
    }
    return 0;
}


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

int main()
{
    int n, m;
    cin >> n >> m;
    string v[100];
    vector<string> left, right;
    string middle;

    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
    }

    for (int i = 0; i < n; i++)
    {
        string t = v[i];
        reverse(t.begin(), t.end());
        if (t == v[i])
        {
            middle = t;
        }
        else
        {
            for (int j = 0; j < n; j++)
            {
                if (j != i)
                {
                    string temp = v[i];
                    string x = v[j];
                    reverse(x.begin(), x.end());
                    if (temp == x && find(left.begin(), left.end(), temp) == left.end() && find(right.begin(), right.end(), x) == right.end())
                    {
                        left.push_back(v[i]);
                        right.push_back(v[j]);
                        break;
                    }
                }
            }
        }
    }
    cout << (left.size() + right.size()) * m + middle.size() << endl;
    for (string x : left)
        cout << x;
    cout << middle;
    for (string x : right)
        cout << x;

    if (left.empty())
    {
        cout << " ";
    }
    return 0;
}


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

int main()
{
    int n, m;
    cin >> n >> m;
    string v[100];
    vector<string> left, right;
    string middle;

    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
    }

    for (int i = 0; i < n; i++)
    {
        string t = v[i];
        reverse(t.begin(), t.end());
        if (t == v[i])
        {
            middle = t;
        }
        else
        {
            for (int j = 0; j < n; j++)
            {
                if (j != i)
                {
                    string temp = v[i];
                    string x = v[j];
                    reverse(x.begin(), x.end());
                    if (temp == x && find(left.begin(), left.end(), temp) == left.end() && find(right.begin(), right.end(), x) == right.end())
                    {
                        left.push_back(v[i]);
                        right.push_back(v[j]);
                        break;
                    }
                }
            }
        }
    }
    cout << (left.size() + right.size()) * m + middle.size() << endl;
    for (string x : left)
        cout << x;
    cout << middle;
    reverse(right.begin(), right.end());
    for (string x : right)
        cout << x;
    if (left.empty())
    {
        cout << " " << endl;
    }
    return 0;
}