func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 50;   char str[maxn];   int pre[30], now[30];   int l, r, len, cnt;   void sov() {     scanf( %s , str);     len = strlen(str);     cnt = 1;     l = 0, r = 0;     memset(now, 0, sizeof(now));     int i = 1;     while (i < len) {       if (str[i] == str[i - 1])         cnt++;       else         break;       i++;     }     if (cnt == len) return;     l = cnt;     cnt = 1;     int j = len - 2;     while (j >= 0) {       if (str[j] == str[j + 1])         cnt++;       else         break;       j--;     }     r = cnt;     if (cnt + l == len) return;     cnt = 1;     for (++i; i <= j + 1; i++) {       if (str[i] != str[i - 1]) {         now[str[i - 1] -  a ] = max(now[str[i - 1] -  a ], cnt);         cnt = 1;       } else if (str[i] == str[i - 1])         cnt++;     }   }   int main() {     int n;     scanf( %d , &n);     for (int j = 0; j < n; j++) {       if (j == 3) int ok = 1;       sov();       if (cnt == len) {         int t = str[0] -  a ;         pre[t] = pre[t] + (pre[t] + 1) * len;         for (int i = 0; i < 26; i++)           if (i != t) {             if (pre[i])               pre[i] = 1;             else               pre[i] = 0;           }       } else if (str[0] == str[len - 1]) {         int t = str[0] -  a ;         if (pre[t])           pre[t] = max(now[t], l + r + 1);         else           pre[t] = max(max(l, r), now[t]);         for (int i = 0; i < 26; i++)           if (i != t) {             if (pre[i])               pre[i] = max(1, now[i]);             else               pre[i] = now[i];           }       } else {         int t = str[0] -  a ;         if (pre[t])           pre[t] = max(1 + l, now[t]);         else           pre[t] = max(l, now[t]);         t = str[len - 1] -  a ;         if (pre[t])           pre[t] = max(1 + r, now[t]);         else           pre[t] = max(r, now[t]);         for (int i = 0; i < 26; i++)           if (i != str[0] -  a  && i != str[len - 1] -  a ) {             if (pre[i])               pre[i] = max(1, now[i]);             else               pre[i] = now[i];           }       }     }     int anss = -1;     for (int i = 0; i < 26; i++) anss = max(anss, pre[i]);     printf( %d n , anss);     return 0;   }   