func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     int n;     cin >> n;     vector<string> nap(n);     for (int i = 0; i < n; ++i) cin >> nap[i];     vector<vector<int> > dp(26);     for (int i = 0; i < 26; ++i)       for (int j = 0; j < 26; ++j) dp[i].push_back(0);     for (int i = 0; i < n; ++i) {       int dl = nap[i].size();       for (char c =  a ; c <=  z ; ++c) {         if (dp[c -  a ][nap[i][0] -  a ] != 0) {           dp[c -  a ][nap[i][dl - 1] -  a ] =               max(dp[c -  a ][nap[i][dl - 1] -  a ],                   dp[c -  a ][nap[i][0] -  a ] + dl);         }       }       dp[nap[i][0] -  a ][nap[i][dl - 1] -  a ] =           max(dp[nap[i][0] -  a ][nap[i][dl - 1] -  a ], dl);     }     int odp = 0;     for (int i = 0; i < 26; ++i) odp = max(odp, dp[i][i]);     cout << odp;     return 0;   }   