import std.stdio, std.conv, std.array, std.string, std.algorithm, std.range;

void main() {
  string s = readln.strip;

  long cnt = 0;
  char last = 'x'; 
  for (long i = 0; i < s.length; i++) {
    if (i+1 < s.length && s[i] != s[i+1]) {
      cnt += 2;
      i++;
    } else {
      if (last != 'x' && last != s[i]) {
        cnt += 2;
        last = 'x';
      } else {
        last = s[i];
      }
    }
  }
  writeln(cnt);
}
