func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, f[2][30], a[100005], b[100005];   string s;   int main() {     scanf( %d , &n);     int now = 1, pre = 0;     for (int i = 1; i <= n; i++, swap(now, pre)) {       cin >> s;       int len = s.length();       memset(f[now], 0, sizeof f[now]);       for (int j = 0; j < len; j++)         a[j] = (j == 0             ? 1                 : s[j - 1] == s[j] ? a[j - 1] + 1                                    : 1),         b[len - j - 1] =             (len - j - 1 == len - 1                 ? 1              : s[len - j - 1 + 1] == s[len - j - 1] ? b[len - j - 1 + 1] + 1                                                     : 1),         f[now][s[j] -  a ] = max(f[now][s[j] -  a ], a[j]);       for (int j = 0; j < 26; j++) {         f[now][j] = max(f[now][j], (f[pre][j] > 0) + (s[0] -  a  == j) * b[0]),         f[now][j] = max(f[now][j],                         (f[pre][j] > 0) + (s[len - 1] -  a  == j) * a[len - 1]);         if (a[len - 1] == len && s[0] -  a  == j)           f[now][j] = max(f[now][j], f[pre][j] + len * (f[pre][j] + 1));         else           f[now][j] = max(f[now][j], (f[pre][j] > 0) + (s[0] -  a  == j) * b[0] +                                          (s[len - 1] -  a  == j) * a[len - 1]);       }     }     int ans = 0;     for (int i = 0; i < 26; i++) ans = max(ans, f[pre][i]);     printf( %d n , ans);   }   