#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  s = '0' + s;
  int len = s.size();
  int dp[len + 2];
  dp[0] = 1;
  for (int i = 1; i < len; i++) dp[i] = 0;
  for (int i = 1; i < len; i++) {
    if ((s[i] - 48) % 3 == 0) {
      dp[i] = 1;
    } else {
      int t = i;
      t--;
      int sum = s[i] - 48;
      while (dp[t] != 1) {
        sum += s[t] - 48;
        if (sum % 3 == 0) {
          dp[i] = 1;
          break;
        }
        t--;
      }
    }
  }
  int count = 0;
  for (int i = 1; i < len; i++) {
    if (dp[i]) count++;
  }
  cout << count;
}
