#include <bits/stdc++.h>
using namespace std;
int main() {
  int number, count, rb, cube;
  cin >> number;
  int first, second;
  first = 2;
  second = 2;
  rb = 2;
  while (number >= 1) {
    second = first;
    first = number % 10;
    number = number / 10;
    if (first == second) {
      cube++;
      first = 2;
      second = 2;
    } else {
      if (second == rb) {
        cube++;
        count--;
        second = 2;
        if (count == 0) {
          rb = 2;
        } else {
          rb++;
          rb = rb % 2;
        }
        if (first == rb) cube++;
        count--;
        first = 2;
        if (count == 0) {
          rb = 2;
        } else {
          rb++;
          rb = rb % 2;
        }
      } else {
        count++;
        rb++;
        rb = rb % 2;
      }
    }
  }
  cube = cube * 2;
  cout << cube;
  return 0;
}
