#include <bits/stdc++.h>
using namespace std;
int main() {
  string is;
  cin >> is;
  int xu = 0, yu = 0, u = 0, gu = 0;
  for (int i = 0; i < is.size(); i++) {
    gu = is[i] - '0';
    if (gu % 3 == 0) {
      u++;
      xu = 0;
      yu = 0;
      continue;
    }
    if ((gu + yu) % 3 == 0) {
      u++;
      xu = 0;
      yu = 0;
      continue;
    }
    if ((gu + xu + yu) % 3 == 0) {
      u++;
      xu = 0;
      yu = 0;
      continue;
    }
    xu = yu;
    yu = gu;
  }
  cout << u;
}
