#include <bits/stdc++.h>
using namespace std;
const int N = 500000 + 5;
int nb[N], nn[N], n, who, lx, ly;
char s[N];
inline int dis(int x, int y, int to) {
  if (1ll * (x - nb[to]) * (y - nn[to]) >= 0)
    return max(abs(x - nb[to]), abs(y - nn[to]));
  return abs(x - nb[to]) + abs(y - nn[to]);
}
inline int getMin(int x, int y) {
  int dd = 0;
  for (int i = 1; i <= n; i++) dd = max(dd, dis(x, y, i));
  return dd;
}
inline int f(int x) {
  int l = 0, r = ly, a, b, dd = 0x3f3f3f3f;
  if (x == 0) l = 1;
  while (r - l >= 10) {
    a = l + (r - l + 1) / 3, b = r - (r - l + 1) / 3;
    if (getMin(x, a) > getMin(x, b)) {
      l = a;
    } else {
      r = b;
    }
  }
  for (int i = l; i <= r; i++) {
    if (getMin(x, i) < dd) dd = getMin(x, i), who = i;
  }
  return dd;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%s", s);
    for (int j = 0; s[j]; j++) {
      if (s[j] == 'B') {
        ++nb[i];
      } else {
        ++nn[i];
      }
      lx = max(lx, nb[i]), ly = max(ly, nn[i]);
    }
  }
  int l = 0, r = lx, a, b;
  while (r - l >= 10) {
    a = l + (r - l + 1) / 3, b = r - (r - l + 1) / 3;
    if (f(a) > f(b)) {
      l = a;
    } else {
      r = b;
    }
  }
  int ans = 0x3f3f3f3f, ax, ay;
  for (int i = l; i <= r; i++) {
    if (f(i) < ans) ans = f(i), ax = i, ay = who;
  }
  printf("%d\n", ans);
  for (int i = 1; i <= ax; i++) printf("B");
  for (int i = 1; i <= ay; i++) printf("N");
  return 0;
}
