func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long int MOD = 1000000007;   const long long int ll_MAX = 1e15;   long long int fast_expo(long long int x, long long int p) {     if (p == 0)       return 1;     else if (p % 2 == 0) {       long long int t = fast_expo(x, p / 2) % MOD;       return (t * t) % MOD;     } else       return (x * (fast_expo(x, p - 1)) % MOD) % MOD;   }   long long int invMod(long long int num) {     return fast_expo(num, MOD - 2) % MOD;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     long long int t_c;     t_c = 1;     for (long long int t_i = 0; t_i < t_c; ++t_i) {       string str;       cin >> str;       long long int n = str.size();       long long int mini[27][n], maxi[27][n];       memset(mini, -1, sizeof(mini));       memset(maxi, -1, sizeof(maxi));       for (long long int k = 1; k < 27; ++k) {         long long int cnt[26]{}, num = 0, j = 0;         for (long long int i = 0; i < n; ++i) {           while (j < n && num != k) {             long long int pos = str[j] -  a ;             if (cnt[pos] == 0) {               num++;             }             cnt[pos]++;             j++;           }           if (num == k) mini[k][i] = j - 1;           long long int pos = str[i] -  a ;           if (cnt[pos] == 1) {             num--;           }           cnt[pos]--;         }       }       for (long long int k = 1; k < 27; ++k) {         long long int cnt[26]{}, num = 0, j = 0;         for (long long int i = 0; i < n; ++i) {           while (j < n && num != k + 1) {             long long int pos = str[j] -  a ;             if (cnt[pos] == 0) {               num++;             }             cnt[pos]++;             j++;           }           if (num == k + 1)             maxi[k][i] = j - 2;           else if (num == k)             maxi[k][i] = n - 1;           long long int pos = str[i] -  a ;           if (cnt[pos] == 1) {             num--;           }           cnt[pos]--;         }       }       long long int ans[27]{}, num = 0;       for (long long int k = 1; k < 27; ++k) {         for (long long int i = 0; i < n; ++i) {           if (mini[k][i] != -1) ans[k] += maxi[k][i] - mini[k][i] + 1;         }         if (ans[k] > 0) {           num = k;         }       }       cout << num << endl;       for (long long int i = 1; i <= num; ++i) cout << ans[i] << endl;     }     return 0;   }   