#include <bits/stdc++.h>
using namespace std;
bool isPalindrome(string s) {
  string s1 = s;
  reverse(s1.begin(), s1.end());
  return s1 == s;
}
bool ispal2(string s1, string s2) {
  string s = s1 + s2;
  return isPalindrome(s);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  if (fopen("input.txt", "r")) {
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  }
  long long t = 1;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    vector<string> v;
    long long i;
    for (i = 0; i < n; i++) {
      string s;
      cin >> s;
      v.push_back(s);
    }
    long long j;
    bool visited[n];
    bool pal[n];
    long long pair[n];
    for (i = 0; i < n; i++) {
      pair[i] = -1;
    }
    memset(visited, 0, sizeof(visited));
    memset(pal, 0, sizeof(pal));
    for (i = 0; i < n; i++) {
      pal[i] = isPalindrome(v[i]);
    }
    for (i = 0; i < n; i++) {
      if (!visited[i]) {
        visited[i] = true;
        for (j = i + 1; j < n; j++) {
          if (ispal2(v[i], v[j]) && !visited[j]) {
            pair[i] = j;
            visited[j] = true;
            break;
          }
        }
      }
    }
    long long res = 0;
    string left = "", right = "", center = "";
    vector<long long> r;
    long long count = 0;
    for (i = 0; i < n; i++) {
      if (pair[i] != -1 && visited[i]) {
        res += 2 * m;
        left += v[i];
        r.push_back(pair[i]);
      } else if (pal[i] && count == 0) {
        center += v[i];
        res += m;
        count++;
      }
    }
    reverse((r).begin(), (r).end());
    cout << res << "\n";
    for (i = 0; i < r.size(); i++) {
      right += v[r[i]];
    }
    cout << left + center + right << "\n";
  }
  return 0;
}
