#include <bits/stdc++.h>
int v, d, a, b;
char c;
int main() {
  while ((c = getchar()) != '\n') {
    v = c - 48;
    if (v % 3 == 0 || (v + a) % 3 == 0 || (v + a + b) % 3 == 0)
      d++, a = b = 0;
    else
      b = a, a = v;
  }
  printf("%d", d);
}
