#include <bits/stdc++.h>
using namespace std;
int n;
int l = (1 << 30), r = -(1 << 30), d = (1 << 30), u = -(1 << 30),
    xyl = (1 << 30), xyr = -(1 << 30);
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    string a;
    cin >> a;
    int x, y;
    x = count(a.begin(), a.end(), 'N');
    y = count(a.begin(), a.end(), 'B');
    l = min(l, x), r = max(r, x);
    d = min(d, y), u = max(u, y);
    xyl = min(xyl, y - x), xyr = max(xyr, y - x);
  }
  int sol = max({r - l, u - d, xyr - (u - r), (u - r) - xyl, 0}), xsol = r,
      ysol = u;
  for (int x = l; x <= r; ++x) {
    int y = (max(u, xyr + x) + min(d, xyl + x)) / 2;
    int dist = max({r - x, x - l, u - y, y - d, xyr - (y - x), (y - x) - xyl});
    if (dist < sol) {
      sol = dist;
      xsol = x;
      ysol = y;
    }
  }
  cout << sol << "\n";
  cout << string(ysol, 'B') + string(xsol, 'N') << "\n";
  return 0;
}
