#include <bits/stdc++.h>   using namespace std;   long long pre[26][100005], suff[26][100005];   int main() {     string s;     cin >> s;     int n = s.length();     if (n == 1) {       cout << 1 << endl;       return 0;     }     if (n == 2) {       if (s[0] == s[1]) {         cout << 2 << endl;         return 0;       }       cout << 1 << endl;       return 0;     }     for (int i = 0; i < n; i++) {       if (i != 0) {         for (int j = 0; j < 26; j++) {           pre[j][i] = pre[j][i - 1];         }       }       int ind = s[i] -  a ;       pre[ind][i]++;     }     long long ans = 0;     map<string, long long> m;     for (int i = 1; i < n; i++) {       string temp =   ;       for (int j = 0; j < 26; j++) {         temp.push_back( a  + j);         temp.push_back(s[i]);         m[temp] += pre[j][i - 1];       }     }     for (auto it = m.begin(); it != m.end(); it++) {       ans = max(ans, it->second);     }     for (int i = 0; i < 26; i++) {       ans = max(ans, pre[i][n - 1]);     }     cout << ans << endl;   }   