#include <bits/stdc++.h>
typedef long long ll;
#define M 1000000007
using namespace std;
void test_case() {
int n;
cin >> n;
}
string s[100];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n = 13;
for (int i = 0; i < n; ++i) {
cin >> s[i];
}
map<char, int> needed;
for (int i = 0; i < n; ++i) {
map<char, int> ne;
for (int j = 0; j < n; ++j) {
ne[s[i][j]]++;
}
for (auto it = ne.begin(); it != ne.end(); it++) {
needed[it->first] = max(needed[it->first], it->second);
}
}
int total = 0;
for (auto it = needed.begin(); it != needed.end(); it++) {
//cout << it->first << ": " << it->second << endl;
total += it->second;
}
string ans = s[0];
for (int i = 1; i < n; ++i) {
// insert characters
int pos = 0;
for (char c : s[i]) {
int f = false;
int j = pos;
for (j = pos; j < (int)ans.length(); ++j) {
if (ans[j] == c) {
f = 1;
break;
}
}
if (f) {
pos = j + 1;
continue;
}
ans.insert(pos, 1, c);
}
}
cout << ans.length() << endl;
while (ans.length() != 1000) {
ans += 'X';
}
cout << ans << endl;
//cout << "total: " << total << endl;
return 0;
}