func_code_string: #include <bits/stdc++.h>   using namespace std;   const bool debug = 1;   int xl = 1 << 30, xr = -(1 << 30), yl = 1 << 30, yr = -(1 << 30), zl = 1 << 30,       zr = -(1 << 30);   bool getpod(pair<int, int> p, int s) {     int pzl = p.first - p.second - s;     int pzr = p.first - p.second + s;     int pxl = p.first - s;     int pxr = p.first + s;     int pyl = p.second - s;     int pyr = p.second + s;     if (pzl <= zl && pzr >= zr && pyl <= yl && pyr >= yr && pxl <= xl &&         pxr >= xr)       return 1;     return 0;   }   int main() {     if (!debug) {       cin.tie(0);       cout.tie(0);       ios::sync_with_stdio(0);     }     int n;     cin >> n;     vector<pair<int, int>> pt(n, {0, 0});     for (int i = 0; i < n; i++) {       string s;       cin >> s;       for (int j = 0; j < s.size(); j++)         if (s[j] ==  B )           pt[i].first++;         else           pt[i].second++;     }     for (int i = 0; i < n; i++) {       xl = min(pt[i].first, xl);       xr = max(pt[i].first, xr);       yl = min(pt[i].second, yl);       yr = max(pt[i].second, yr);       zl = min(pt[i].first - pt[i].second, zl);       zr = max(pt[i].first - pt[i].second, zr);     }     vector<pair<int, int>> p(12);     vector<int> s(12);     {       int l = -1, r = 1 << 23;       while (l + 1 < r) {         int c = (l + r) / 2;         pair<int, int> p = {zr + yl, yl + c};         if (getpod(p, c))           r = c;         else           l = c;       }       s[0] = r;       p[0] = {zr + yl, yl + s[0]};     }     {       int l = -1, r = 1 << 23;       while (l + 1 < r) {         int c = (l + r) / 2;         pair<int, int> p = {xl + c, xl - zl};         if (getpod(p, c))           r = c;         else           l = c;       }       s[1] = r;       p[1] = {xl + s[1], xl - zl};     }     {       int l = -1, r = 1 << 23;       while (l + 1 < r) {         int c = (l + r) / 2;         pair<int, int> p = {zl + yr, yr - c};         if (getpod(p, c))           r = c;         else           l = c;       }       s[2] = r;       p[2] = {zl + yr, yr - s[2]};     }     {       int l = -1, r = 1 << 23;       while (l + 1 < r) {         int c = (l + r) / 2;         pair<int, int> p = {xr - c, xr - zr};         if (getpod(p, c))           r = c;         else           l = c;       }       s[3] = r;       p[3] = {xr - s[3], xr - zr};     }     {       int l = -1, r = 1 << 23;       while (l + 1 < r) {         int c = (l + r) / 2;         pair<int, int> p = {xr - c, yr - c};         if (getpod(p, c))           r = c;         else           l = c;       }       s[4] = r;       p[4] = {xr - s[4], yr - s[4]};     }     {       int l = -1, r = 1 << 23;       while (l + 1 < r) {         int c = (l + r) / 2;         pair<int, int> p = {xl + c, yl + c};         if (getpod(p, c))           r = c;         else           l = c;       }       s[5] = r;       p[5] = {xl + s[5], yl + s[5]};     }     {       int l = -1, r = zl - xl + yr;       while (l + 1 < r) {         int c = (l + r) / 2;         pair<int, int> p = {xl + c, yr - c};         if (getpod(p, c))           r = c;         else           l = c;       }       s[6] = r;       p[6] = {xl + s[6], yr - s[6]};     }     {       int l = -1, r = xr - yl - zr;       while (l + 1 < r) {         int c = (l + r) / 2;         pair<int, int> p = {xr - c, yl + c};         if (getpod(p, c))           r = c;         else           l = c;       }       s[7] = r;       p[7] = {xr - s[7], yl + s[7]};     }     {       int l = -1, r = xr - zl - yr;       while (l + 1 < r) {         int c = (l + r) / 2;         pair<int, int> p = {xr - c, xr - zl - 2 * c};         if (getpod(p, c))           r = c;         else           l = c;       }       s[8] = r;       p[8] = {xr - s[8], xr - zl - 2 * s[8]};     }     {       int l = -1, r = zr + yr - xr;       while (l + 1 < r) {         int c = (l + r) / 2;         pair<int, int> p = {zr + yr - 2 * c, yr - c};         if (getpod(p, c))           r = c;         else           l = c;       }       s[9] = r;       p[9] = {zr + yr - 2 * s[9], yr - s[9]};     }     {       int l = -1, r = yl + zr - xl;       while (l + 1 < r) {         int c = (l + r) / 2;         pair<int, int> p = {xl + c, xl - zr + 2 * c};         if (getpod(p, c))           r = c;         else           l = c;       }       s[10] = r;       p[10] = {xl + s[10], xl - zr + 2 * s[10]};     }     {       int l = -1, r = xl - zl - yl;       while (l + 1 < r) {         int c = (l + r) / 2;         pair<int, int> p = {zl + yl + 2 * c, yl + c};         if (getpod(p, c))           r = c;         else           l = c;       }       s[11] = r;       p[11] = {zl + yl + 2 * s[11], yl + s[11]};     }     int iout = 0;     for (int i = 0; i < 12; i++)       if (s[i] < s[iout] && getpod(p[i], s[i])) iout = i;     cout << s[iout] <<   n ;     for (int i = 0; i < p[iout].first; i++) cout <<  B ;     for (int i = 0; i < p[iout].second; i++) cout <<  N ;     return 0;   }   