#include <bits/stdc++.h>
using namespace std;
int func(char* a, char* b, int n) {
  for (int i = 0; i < n; i++) {
    if (a[i] != b[n - 1 - i]) {
      return 0;
    }
  }
  return 1;
}
int func1(char* a, int n) {
  for (int i = 0; i < n / 2; i++) {
    if (a[i] != a[n - 1 - i]) {
      return 0;
    }
  }
  return 1;
}
int main() {
  int n, m;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("\n");
  char A[n][m];
  int B[n];
  for (int i = 0; i < n; i++) {
    B[i] = 0;
    for (int j = 0; j < m; j++) {
      scanf("%c", &A[i][j]);
    }
    if (i != n - 1) {
      scanf("\n");
    }
  }
  char C[10000];
  int y = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (func(A[i], A[j], m) && B[i] == 0 && B[j] == 0) {
        for (int k = y; k < y + m; k++) {
          C[k] = A[i][k - y];
        }
        y = y + m;
        B[i] = 1;
        B[j] = 1;
      }
    }
  }
  int io = 0;
  for (int i = 0; i < n; i++) {
    if (func1(A[i], m) && B[i] == 0) {
      io = 1;
      break;
    }
  }
  printf("%d\n", 2 * y + m * io);
  for (int i = 0; i < y; i++) {
    printf("%c", C[i]);
  }
  for (int i = 0; i < n; i++) {
    if (func1(A[i], m) && B[i] == 0) {
      for (int j = 0; j < m; j++) {
        printf("%c", A[i][j]);
      }
      break;
    }
  }
  for (int i = y - 1; i >= 0; i--) {
    printf("%c", C[i]);
  }
}
