#include <bits/stdc++.h>
using namespace std;
template <typename G1, typename G2 = G1, typename G3 = G1>
struct triple {
  G1 first;
  G2 second;
  G3 T;
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<pair<int, int> > v;
  for (int i = 0; i < n; i++) {
    int a = 0, b = 0;
    string s;
    cin >> s;
    for (auto &j : s) {
      a += (j == 'B');
      b += (j == 'N');
    }
    v.push_back({a, b});
  }
  const int oo = 5e5 + 5;
  int up = -oo, down = oo, left = oo, right = -oo;
  for (auto i : v) {
    up = max(up, i.second);
    down = min(down, i.second);
    left = min(left, i.first);
    right = max(right, i.first);
  }
  auto val = [](pair<int, int> a, pair<int, int> b) {
    if (a > b) swap(a, b);
    if (a.second > b.second) return b.first - a.first + a.second - b.second;
    int x = b.first - a.first, y = b.second - a.second;
    return max(x, y);
  };
  auto val1 = [&](int x, int y) {
    int ret = 0;
    for (auto &i : v) ret = max(ret, val(i, {x, y}));
    return ret;
  };
  auto val2 = [&](int x) {
    int li = down + (x == 0 && down == 0), ri = up;
    while (ri - li >= 10) {
      int m1 = li + (ri - li) / 3;
      int m2 = li + 2 * (ri - li) / 3;
      if (val1(x, m1) <= val1(x, m2))
        ri = m2;
      else
        li = m1;
    }
    pair<int, int> ret = {1e7, -1};
    for (int i = li; i <= ri; i++) {
      ret = min(ret, {val1(x, i), i});
    }
    return ret;
  };
  int li = left, ri = right;
  while (ri - li >= 10) {
    int m1 = li + (ri - li) / 3;
    int m2 = li + 2 * (ri - li) / 3;
    if (val2(m1) <= val2(m2))
      ri = m2;
    else
      li = m1;
  }
  int ans = 1e7, x = -1, y = -1;
  for (int i = li; i <= ri; i++) {
    pair<int, int> temp = val2(i);
    if (temp.first < ans) {
      ans = temp.first;
      x = i;
      y = temp.second;
    }
  }
  cout << ans << '\n';
  for (int i = 0; i < x; i++) cout << 'B';
  for (int i = 0; i < y; i++) cout << 'N';
  cout << '\n';
  return 0;
}
