#include <bits/stdc++.h>
using namespace std;
using li = long long;
using ld = long double;
int f(int dx, int dy) {
  if (dx >= 0 && dy >= 0) {
    return max(dx, dy);
  }
  if (dx <= 0 && dy <= 0) {
    return max(-dx, -dy);
  }
  if (dx >= 0 && dy <= 0) {
    return dx - dy;
  }
  if (dx <= 0 && dy >= 0) {
    return dy - dx;
  }
  abort();
}
void solve(bool read) {
  int n;
  cin >> n;
  vector<int> xs, ys;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    int x = count((s).begin(), (s).end(), 'N');
    int y = count((s).begin(), (s).end(), 'B');
    xs.push_back(x);
    ys.push_back(y);
  }
  int low = -1, high = 1e9;
  int foundX = 0;
  int foundY = 0;
  auto can = [&](int size) {
    const int INF = 1e9;
    int xGe = 0;
    int xLe = INF;
    int yGe = 0;
    int yLe = INF;
    int xmyGe = -INF;
    int xmyLe = INF;
    for (int i = 0; i < n; ++i) {
      xGe = max(xGe, xs[i] - size);
      xLe = min(xLe, xs[i] + size);
      yGe = max(yGe, ys[i] - size);
      yLe = min(yLe, ys[i] + size);
      xmyGe = max(xmyGe, xs[i] - ys[i] - size);
      xmyLe = min(xmyLe, xs[i] - ys[i] + size);
    }
    if (xGe > xLe) {
      return false;
    }
    if (yGe > yLe) {
      return false;
    }
    bool found = false;
    auto test = [&](int x, int y) {
      if (x >= xGe && y >= yGe && x <= xLe && y <= yLe && x - y <= xmyLe &&
          x - y >= xmyGe) {
        if (x != 0 || y != 0) {
          found = true;
          foundX = x;
          foundY = y;
        }
      }
    };
    test(xGe, yGe);
    test(xLe, yLe);
    test(xGe, yLe);
    test(xLe, yGe);
    test(xGe, -xmyGe + xGe);
    test(xLe, -xmyGe + xLe);
    test(xmyGe + yGe, yGe);
    test(xmyGe + yLe, yLe);
    test(xGe, -xmyLe + xGe);
    test(xLe, -xmyLe + xLe);
    test(xmyLe + yGe, yGe);
    test(xmyLe + yLe, yLe);
    return found;
  };
  while (low + 1 != high) {
    int m = (low + high) / 2;
    if (can(m)) {
      high = m;
    } else {
      low = m;
    }
  }
  assert(can(high));
  int answer = 0;
  int x = foundX;
  int y = foundY;
  for (int i = 0; i < xs.size(); ++i) {
    answer = max(answer, f(xs[i] - x, ys[i] - y));
  }
  cout << answer << "\n";
  cout << string(y, 'B') + string(x, 'N') << "\n";
  assert(answer == high);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  solve(true);
  return 0;
}
