#include <bits/stdc++.h>
using namespace std;
string s;
int ans, pre, cnt;
int main() {
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    pre += s[i] - '0';
    cnt++;
    if (cnt == 3 || (s[i] - '0') % 3 == 0 || pre % 3 == 0)
      ans++, pre = 0, cnt = 0;
  }
  cout << ans << endl;
  return 0;
}
