#include <bits/stdc++.h>
using namespace std;
int main() {
  long int a, b, c, d, e, flag = 0, h = 0, H[100], P[100][2], p = 0;
  cin >> a >> b;
  char A[a][b];
  for (c = 0; c < a; c++) {
    flag = 0;
    for (d = 0; d < b; d++) {
      cin >> A[c][d];
    }
    if (h == 0) {
      for (d = 0; d < b; d++) {
        if (A[c][d] != A[c][(b - d - 1)]) {
          flag = 1;
          break;
        }
      }
      if (flag == 0) {
        H[h] = c;
        h = 1;
      }
    }
  }
  for (c = 0; c < (a); c++) {
    for (d = c + 1; d < (a); d++) {
      if (A[c][0] == A[d][b - 1]) {
        flag = 0;
        for (e = 0; e < b; e++) {
          if (A[c][e] != A[d][b - e - 1]) {
            flag = 1;
            break;
          }
        }
        if (flag == 0) {
          P[p][0] = c;
          P[p][1] = d;
          p++;
        }
      }
    }
  }
  if (h == 1) {
    cout << (h + (2 * p)) * b << endl;
    for (c = 0; c < p; c++) {
      for (d = 0; d < b; d++) {
        cout << A[(P[c][0])][d];
      }
    }
    for (d = 0; d < b; d++) {
      cout << A[H[0]][d];
    }
    for (c = (p - 1); c >= 0; c--) {
      for (d = 0; d < b; d++) {
        cout << A[(P[c][1])][d];
      }
    }
  } else {
    cout << (h + (2 * p)) * b << endl;
    for (c = 0; c < p; c++) {
      for (d = 0; d < b; d++) {
        cout << A[(P[c][0])][d];
      }
    }
    for (c = (p - 1); c >= 0; c--) {
      for (d = 0; d < b; d++) {
        cout << A[(P[c][1])][d];
      }
    }
  }
}
