#include <bits/stdc++.h>
using namespace std;
const long long hmod1 = 999999937;
const long long hmod2 = 1000000000 + 9;
const long long INF = 1 << 30;
const long long mod = 1000000000 + 7;
const long long dx4[4] = {1, 0, -1, 0};
const long long dy4[4] = {0, 1, 0, -1};
const long long dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const long long dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;
string s;
long long n;
long long cnt[200000 + 5][26];
long long dp[200000 + 5];
vector<vector<long long>> v(200000 + 5);
bool check(long long now, long long m) {
  for (auto idx : v[m]) {
    long long odd = 0;
    for (long long j = 0; j < (26); j++) {
      if ((cnt[now][j] - cnt[idx][j]) % 2 == 1) odd++;
    }
    if ((now - idx) % 2 == 0 && odd == 0)
      return true;
    else if ((now - idx) % 2 == 1 && odd == 1)
      return true;
  }
  return false;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> s;
  long long n = s.size();
  for (long long i = 0; i < (n); i++) {
    cnt[i + 1][s[i] - 'a']++;
  }
  for (long long i = 0; i < (n); i++)
    for (long long j = 0; j < (26); j++) {
      cnt[i + 1][j] += cnt[i][j];
    }
  dp[0] = 0;
  dp[1] = 1;
  long long l = -1;
  long long r = 1;
  for (long long i = 0; i < (n + 1); i++) v[i].push_back(0);
  v[0].push_back(0);
  for (long long i = (1); i < (n); i++) {
    long long tmpl = l;
    long long tmpr = r;
    bool ok1 = false;
    while (tmpr - tmpl > 1) {
      long long m = (tmpr + tmpl) / 2;
      if (check(i + 1, m)) {
        tmpr = m;
        ok1 = true;
      } else
        tmpl = m;
    }
    if (ok1) {
      dp[i + 1] = tmpr + 1;
      v[dp[i + 1]].push_back(i + 1);
    } else {
      dp[i + 1] = dp[i] + 1;
      v[dp[i + 1]].push_back(i + 1);
    }
    r = max(r, dp[i + 1]);
  }
  for (long long i = (1); i < (n + 1); i++) cout << i << " " << dp[i] << endl;
  cout << dp[n] << endl;
}
