#include <bits/stdc++.h>
const int maxn = 1e6 + 3;
int n;
struct pt {
  int u, v;
} p[maxn];
char buf[maxn];
int ansu, ansv, answ;
bool findSolution(int l, int r, int d, int u, int lu, int rd) {
  auto check = [&]() {
    if (ansu + ansv <= 0) return false;
    return l <= ansu && ansu <= r && d <= ansv && ansv <= u &&
           rd <= ansv - ansu && ansv - ansu <= lu;
  };
  ansu = l, ansv = d;
  if (check()) return true;
  ansu = r, ansv = d;
  if (check()) return true;
  ansu = l, ansv = u;
  if (check()) return true;
  ansu = r, ansv = u;
  if (check()) return true;
  ansu = l, ansv = rd + ansu;
  if (check()) return true;
  ansu = r, ansv = rd + ansu;
  if (check()) return true;
  ansv = d, ansu = ansv - rd;
  if (check()) return true;
  ansv = u, ansu = ansv - rd;
  if (check()) return true;
  ansu = l, ansv = lu + ansu;
  if (check()) return true;
  ansu = r, ansv = lu + ansu;
  if (check()) return true;
  ansv = d, ansu = ansv - lu;
  if (check()) return true;
  ansv = u, ansu = ansv - lu;
  if (check()) return true;
  return false;
}
bool checkAns(int w) {
  int l = 0, r = INT_MAX, d = 0, u = INT_MAX, lu = INT_MAX, rd = INT_MIN;
  for (int i = 0; i < n; ++i) {
    l = std::max(l, p[i].u - w);
    r = std::min(r, p[i].u + w);
    d = std::max(d, p[i].v - w);
    u = std::min(u, p[i].v + w);
    lu = std::min(lu, p[i].v - p[i].u + w);
    rd = std::max(rd, p[i].v - p[i].u - w);
  }
  if (l > r || d > u || rd > lu) return false;
  if (!findSolution(l, r, d, u, lu, rd)) return false;
  answ = w;
  return true;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%s", buf);
    int l = strlen(buf);
    for (int j = 0; j < l; ++j) {
      if (buf[j] == 'B')
        p[i].u += 1;
      else
        p[i].v += 1;
    }
  }
  int l = 0, r = maxn;
  while (r - l > 1) {
    int mid = (l + r) / 2;
    if (checkAns(mid - 1))
      r = mid;
    else
      l = mid;
  }
  checkAns(r - 1);
  printf("%d\n", answ);
  for (int i = 0; i < ansu; ++i) putchar('B');
  for (int i = 0; i < ansv; ++i) putchar('N');
  putchar('\n');
  return 0;
}
