func_code_string: #include <bits/stdc++.h>   using namespace std;   const int mxN = 1e5;   int n;   string ans;   int kmp(string s) {     vector<int> pf(s.size());     for (int j = 1; j < s.size(); ++j) {       int k = pf[j - 1];       while (s[k] != s[j]) {         if (!k) {           k = -1;           break;         }         k = pf[k - 1];       }       pf[j] = k + 1;     }     return pf.back();   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cin >> n;     for (int i = 0; i < n; ++i) {       if (!i) {         cin >> ans;         continue;       }       string s;       cin >> s;       string t = s;       t +=  # ;       int a = min((int)ans.size(), (int)s.size());       t.insert(t.end(), ans.end() - a, ans.end());       int x = kmp(t);       while (x--) ans.pop_back();       ans.insert(ans.end(), s.begin(), s.end());     }     cout << ans;   }   