func_code_string: #include <bits/stdc++.h>   using namespace std;   using ll = long long;   int main() {     cin.tie(0);     cin.sync_with_stdio(0);     int n;     cin >> n;     vector<string> a(2 * n - 2);     map<string, vector<int>> m;     for (int i = 0; i < 2 * n - 2; ++i) {       cin >> a[i];       m[a[i]].emplace_back(i);     }     int x = -1, y = -1;     for (int i = 0; i < 2 * n - 2; ++i) {       auto const& s = a[i];       if ((int)s.size() == n - 1) {         if (x == -1)           x = i;         else           y = i;       }     }     string ans(2 * n - 2,  S );     string u = a[x];     string v = a[y];     map<string, int> cc1, cc2;     for (int i = 0; i + 1 < n; ++i) {       ++cc1[u.substr(0, i + 1)];       ++cc1[v.substr(i, n - 1 - i)];       ++cc2[v.substr(0, i + 1)];       ++cc2[u.substr(i, n - 1 - i)];     }     bool can1 = true;     bool can2 = true;     for (auto const& [x, f] : m) {       can1 &= (cc1[x] == int(f.size()));       can2 &= (cc2[x] == int(f.size()));     }     if (not can1) {       swap(cc1, cc2);       swap(u, v);     }     for (int i = 0; i + 1 < n; ++i) {       auto p1 = u.substr(0, i + 1);       auto s1 = v.substr(i, n - 1 - i);       int idx1 = m[p1].back();       m[p1].pop_back();       int idx2 = m[s1].back();       m[s1].pop_back();       ans[idx1] =  P ;       ans[idx2] =  S ;     }     cout << ans;   }   