func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize(2)   #pragma GCC optimize(3)   #pragma GCC optimize( Ofast )   using namespace std;   namespace ywy {   char v[300][300];   long long dk1[300], dk2[300];   int dp[600];   typedef struct _p {     long long h1, h2;     _p() {       h1 = 2333;       h2 = 6663;     }     friend bool operator==(const _p &a, const _p &b) {       return (a.h1 == b.h1 && a.h2 == b.h2);     }     friend bool operator!=(const _p &a, const _p &b) {       return ((a.h1 != b.h1) || (a.h2 != b.h2));     }     inline void insert(char x) {       h1 += dk1[x -  a  + 1];       h1 %= 998244353;       h2 += dk2[x -  a  + 1];       h2 %= 1000000007;     }   } pair;   pair str[600], real[600];   int s[300];   inline int solve(int n) {     int ptr = 0, mid = 1, ans = 0;     for (register int i = 2; i <= n; i++) {       if (mid + ptr < i)         mid = i, ptr = 0, dp[i] = 0;       else         dp[i] = min(mid + ptr - i, dp[mid * 2 - i]);       while (dp[i] < min(n - i, i - 1) &&              str[i + dp[i] + 1] == str[i - dp[i] - 1])         dp[i]++;       if (i + dp[i] >= mid + ptr) mid = i, ptr = dp[i];       if ((i & 1) == 0 && (s[i >> 1] != (s[i >> 1] & -s[i >> 1]))) continue;       ans += (dp[i] + 1) / 2;     }     return (ans);   }   void ywymain() {     int n, m;     cin >> n >> m;     for (register int i = 1; i <= n; i++) {       for (register int j = 1; j <= m; j++) cin >> v[i][j];     }     dk1[0] = dk2[0] = 1;     for (register int i = 1; i <= 26; i++) {       dk1[i] = (dk1[i - 1] * 233) % 998244353;       dk2[i] = (dk2[i - 1] * 233) % 1000000007;     }     int ans = 0;     for (register int l = 1; l <= m; l++) {       memset(s, 0, sizeof(s));       for (register int i = 1; i <= n * 2 + 1; i++) str[i] = real[i] = _p();       for (register int r = l; r <= m; r++) {         for (register int i = 1; i <= n; i++) {           s[i] ^= (1 << (v[i][r] - 1));           real[i].insert(v[i][r]);           if (s[i] != (s[i] & -s[i])) {             str[i * 2].h1 = i + 19260817;             str[i * 2].h2 = 19260817 - i;           } else             str[i * 2] = real[i];         }         ans += solve(n * 2 + 1);       }     }     cout << ans << endl;   }   }  // namespace ywy   int main() {     ywy::ywymain();     return (0);   }   