#include <bits/stdc++.h>
char a[200005];
int main() {
  scanf("%s", a);
  int count = 0;
  int le = 1;
  int l = strlen(a) - 1;
  int pd = a[l] - 48;
  for (int i = l; i >= 0; i--) {
    if (pd % 3 == 0 || le == 3) {
      count++;
      le = 1;
      pd = a[i - 1] - 48;
    } else {
      le++;
      pd += (a[i - 1] - 48);
      if ((a[i - 1] - 48) % 3 == 0) {
        pd = a[i - 1] - 48;
      }
    }
  }
  printf("%d\n", count);
}
