func_code_string: #include <bits/stdc++.h>   using namespace std;   int f[200][200], c[500010], n, i, j, ans;   char a[500010], b[500010], str[20];   int main() {     cin >> n;     for (i = 1; i <= n; i++) {       scanf( %s , str);       a[i] = str[0], b[i] = str[strlen(str) - 1], c[i] = strlen(str);     }     memset(f, -1, sizeof(f));     for (i = 1; i <= n; i++) {       for (j =  a ; j <=  z ; j++)         if (f[j][a[i]] != -1) f[j][b[i]] = max(f[j][b[i]], f[j][a[i]] + c[i]);       f[a[i]][b[i]] = max(f[a[i]][b[i]], c[i]);     }     for (i =  a ; i <=  z ; i++) ans = max(ans, f[i][i]);     cout << ans << endl;     return 0;   }   