func_code_string: #include <bits/stdc++.h>   using namespace std;   using vec_i = vector<int>;   using pii = pair<int, int>;   using ll = long long;   using vec_ii = vector<pii>;   using vec_ll = vector<ll>;   template <typename T>   using vec = vector<T>;   ll gcd(ll x, ll y) {     ll m;     while (y > 0) {       m = x % y;       x = y;       y = m;     }     return x;   }   ll powm(ll x, ll n, ll m) {     ll r = 1;     while (n > 0) {       if (n & 1) r = r * x % m;       x = x * x % m;       n /= 2;     }     return r;   }   static const int MOD = 1000000000 + 7;   static const int P = 343434;   const int PA = 257, PB = 983, MODA = 1e9 + 7, MODB = 1e9 + 9;   int n, m;   char ss[256][256];   int tt[256][256];   bool pal[256];   int hash_a[256], hash_b[256];   ll hash_lalaku[256];   int pa_pows[256], pb_pows[256];   inline bool is_pow2(int val) { return val != 0 && (val & (val - 1)) == 0; }   inline bool is_pal(int val, bool odd) {     return (odd && is_pow2(val)) || ((!odd) && (val == 0));   }   int solve() {     pa_pows[0] = 1;     pb_pows[0] = 1;     for (int i = 1; i < 256; ++i) {       pa_pows[i] = pa_pows[i - 1] * 1ll * PA % MODA;       pb_pows[i] = pb_pows[i - 1] * 1ll * PB % MODB;     }     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; ++i) {       scanf( %s , ss[i] + 1);     }     for (int i = 1; i <= n; ++i) {       for (int j = 1; j <= m; ++j) {         int val, c;         c = ss[i][j] -  a  + 1;         val = (1 << c);         tt[i][j] = tt[i][j - 1] ^ val;       }     }     ll ans = 0;     for (int i = 1; i <= m; ++i) {       memset(hash_a, 0, sizeof(hash_a));       memset(hash_b, 0, sizeof(hash_b));       for (int j = i; j <= m; ++j) {         bool all_same = true;         for (int k = 1; k <= n; ++k) {           pal[k] = is_pal(tt[k][j] ^ tt[k][i - 1], (j - i + 1) & 1);           hash_a[k] += pa_pows[ss[k][j] -  a  + 1];           hash_b[k] += pb_pows[ss[k][j] -  a  + 1];           if (hash_a[k] >= MODA) hash_a[k] -= MODA;           if (hash_b[k] >= MODB) hash_b[k] -= MODB;           hash_lalaku[k] = ((ll)hash_a[k] << 32) | (hash_b[k]);           all_same = (all_same) && pal[k] &&                      (k == 1 || hash_lalaku[k] == hash_lalaku[k - 1]);         }         if (all_same) {           ans += (n * (n + 1)) / 2;           continue;         }         for (int k = 1; k <= n; ++k) {           if (pal[k]) {             int l = k, r = k;             while (l > 1 && r < n && pal[l - 1] && pal[r + 1] &&                    hash_lalaku[l - 1] == hash_lalaku[r + 1]) {               --l;               ++r;             }             ans += (r - l + 1 + 1) / 2;           }           if (k < n && pal[k + 1] && hash_lalaku[k] == hash_lalaku[k + 1]) {             int l = k, r = k + 1;             while (l > 1 && r < n && pal[l - 1] && pal[r + 1] &&                    hash_lalaku[l - 1] == hash_lalaku[r + 1]) {               --l;               ++r;             }             ans += (r - l + 1) / 2;           }         }       }     }     printf( %lld n , ans);     return 0;   }   int main(int argc, char* argv[]) {     ::std::ios::sync_with_stdio(false);     ::std::cin.tie(0);     ::std::cout.tie(0);     int test_count = 1;     while (test_count--) {       solve();     }     return 0;   }   