#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.length();
  int ans = 0;
  int num = 0;
  for (int i = 0; i < n; i++) {
    if ((s[i] - '0') % 3 == 0) {
      ans++;
      num = 0;
    } else {
      num++;
      if (num == 2) {
        if ((s[i - 1] - '0' + s[i] - '0') % 3 == 0) {
          ans++;
          num = 0;
        }
      }
      if (num == 3) {
        ans++;
        num = 0;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
