#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int n, mx = 0;
  cin >> n;
  string s;
  vector<pair<int, int>> a(n);
  for (auto &i : a) {
    cin >> s;
    for (auto j : s)
      if (j == 'B')
        ++i.first;
      else
        ++i.second;
    mx = max(mx, (int)s.length());
  }
  auto f = [&](int x, int y) {
    int ans = 0;
    int c, d;
    for (auto i : a) {
      tie(c, d) = i;
      int o = max(0, min(c - x, d - y)), w = 0;
      w += o;
      c -= o, d -= o;
      o = max(0, min(x - c, y - d));
      w += o;
      c += o, d += o;
      w += abs(c - x) + abs(d - y);
      ans = max(ans, w);
    }
    return ans;
  };
  auto g = [&](int x) {
    int l = (x == 0), r = mx - x;
    while (r - l > 3) {
      int len1 = (r - l) / 3;
      int md1 = l + len1;
      int md2 = r - len1;
      if (f(x, md1) < f(x, md2))
        r = md2;
      else
        l = md1;
    }
    int c = 2e9, w;
    for (; l <= r; ++l) {
      int nc = f(x, l);
      if (nc < c) c = nc, w = l;
    }
    return make_pair(c, w);
  };
  int l = 0, r = mx;
  while (r - l > 3) {
    int len1 = (r - l) / 3;
    int md1 = l + len1;
    int md2 = r - len1;
    if (g(md1).first < g(md2).first)
      r = md2;
    else
      l = md1;
  }
  int c = 2e9, w;
  for (; l <= r; ++l) {
    int nc = g(l).first;
    if (nc < c) c = nc, w = l;
  }
  auto val = g(w);
  string ans = string(w, 'B') + string(val.second, 'N');
  cout << val.first << "\n" << ans << "\n";
  return 0;
}
