#include <bits/stdc++.h>
2
using namespace std;
3
 
4
int main() {
5
  string S;
6
  cin>>S;
7
  int count=0;
8
  int N=S.size();
9
  while(N>0){
10
    
11
    if(N==1){
12
      count++;
13
      break;
14
    }
15
    if(S.at(N-1)!=S.at(N-2)){
16
      S.pop_back();
17
    }
18
    else{
19
      S.pop_back();
20
      S.pop_back();
21
    }
22
    count++;
23
    N=S.size();
24
  }
25
  cout<<count<<endl;
26
}