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