#include <bits/stdc++.h>
using namespace std;
string S;
void SERCH() {
  for (int i = 0, j = 0; i < S.size() - 1;) {
    if (S[i] != '*') {
      bool t = true;
      for (int j = i + 1; j < S.size(); j++) {
        if (S[j] != '*' && S[j] == S[i]) {
          S[j] = '*', S[i] = '*';
          i = j + 1;
          t = false;
          break;
        } else if (S[j] != '*') {
          i = j;
          t = false;
          break;
        }
      }
      if (t) break;
    } else if (S[i] == '*')
      i++;
  }
}
int main() {
  cin >> S;
  for (int i = 0; i < S.size() / 2; i++) SERCH();
  int ans = 0;
  for (int i = 0; i < S.size(); i++) {
    if (S[i] == '*') ans++;
  }
  cout << ans << endl;
}
