Problem: Polycarp likes numbers that are divisible by 3.

He has a huge number s. Polycarp wants to cut from it the maximum number of numbers that are divisible by 3. To do this, he makes an arbitrary number of vertical cuts between pairs of adjacent digits. As a result, after m such cuts, there will be m+1 parts in total. Polycarp analyzes each of the obtained numbers and finds the number of those that are divisible by 3.

For example, if the original number is s=3121, then Polycarp can cut it into three parts with two cuts: 3|1|21. As a result, he will get two numbers that are divisible by 3.

Polycarp can make an arbitrary number of vertical cuts, where each cut is made between a pair of adjacent digits. The resulting numbers cannot contain extra leading zeroes (that is, the number can begin with 0 if and only if this number is exactly one character '0'). For example, 007, 01 and 00099 are not valid numbers, but 90, 0 and 10001 are valid.

What is the maximum number of numbers divisible by 3 that Polycarp can obtain?

Input

The first line of the input contains a positive integer s. The number of digits of the number s is between 1 and 2⋅10^5, inclusive. The first (leftmost) digit is not equal to 0.

Output

Print the maximum number of numbers divisible by 3 that Polycarp can get by making vertical cuts in the given number s.

Examples

Input

3121


Output

2


Input

6


Output

1


Input

1000000000000000000000000000000000


Output

33


Input

201920181


Output

4

Note

In the first example, an example set of optimal cuts on the number is 3|1|21.

In the second example, you do not need to make any cuts. The specified number 6 forms one number that is divisible by 3.

In the third example, cuts must be made between each pair of digits. As a result, Polycarp gets one digit 1 and 33 digits 0. Each of the 33 digits 0 forms a number that is divisible by 3.

In the fourth example, an example set of optimal cuts is 2|0|1|9|201|81. The numbers 0, 9, 201 and 81 are divisible by 3.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int dx4[] = {-1, 0, 1, 0};
const int dy4[] = {0, 1, 0, -1};
const int dx8[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dy8[] = {0, 1, 0, -1, -1, 1, -1, 1};
const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};
template <typename T>
inline T ItoS(T n) {
  stringstream a;
  a << n;
  return a.str();
}
template <typename T>
inline T TrailingZeros(T n) {
  long long cnt = 0;
  for (long long i = 5; n / i >= 1; i *= 5) cnt += n / i;
  return cnt;
}
template <typename T>
inline T StoI(T s) {
  long long sum = 0;
  for (long long i = 0; i < s.size(); i++) {
    s[i] -= '0';
    sum = sum * 10 + s[i];
  }
  return sum;
}
template <typename T>
inline T binary_decimal(T n) {
  long long decimal = 0, i = 0, rem;
  while (n != 0) {
    rem = n % 10;
    n /= 10;
    decimal += rem * pow(2, i);
    ++i;
  }
  return decimal;
}
template <typename T>
inline T LCM(T a, T b) {
  return (a * b) / GCD(a, b);
}
template <typename T>
inline T maxi(T x, T y) {
  if (x > y)
    return x;
  else
    return y;
}
template <typename T>
inline T maxi(T x, T y, T z) {
  return maxi(maxi(x, y), z);
}
template <typename T>
inline T mini(T x, T y) {
  if (x < y)
    return x;
  else
    return y;
}
template <typename T>
inline T mini(T x, T y, T z) {
  return mini(mini(x, y), z);
}
template <typename T>
inline T GCD(T a, T b) {
  long long t;
  while (a) {
    t = a;
    a = b % a;
    b = t;
  }
  return b;
}
template <typename T>
inline T Pow(T base, T exp) {
  long long result = 1;
  while (exp) {
    if (exp & 1) result *= base;
    exp >>= 1;
    base *= base;
  }
  return result;
}
template <typename T>
inline T Mulmod(T a, T b, T c) {
  unsigned long long x = 0, y = a % c;
  while (b > 0) {
    if (b & 1) x = (x + y) % c;
    y = (y << 1) % c;
    b >>= 1;
  }
  return x;
}
template <typename T>
inline T Pow(T base, T exp, T mod) {
  unsigned long long x = 1, y = base;
  while (exp > 0) {
    if (exp & 1) x = Mulmod(x, y, mod);
    y = Mulmod(y, y, mod);
    exp >>= 1;
  }
  return x;
}
template <typename T>
inline T modulo(T a, T b, T c) {
  unsigned long long x = 1, y = a % c;
  while (b > 0) {
    if (b % 2) x = Mulmod(x, y, c);
    y = Mulmod(y, y, c);
    b /= 2;
  }
  return x % c;
}
template <typename T>
inline T BigMod(T a, T b, T m) {
  if (!b) return 1;
  long long x = BigMod(a, b / 2, m);
  x = (x * x) % m;
  if (b % 2) x = (x * a) % m;
  return x;
}
template <typename T>
inline T EGCD(T a, T b, T &x, T &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  T x1, y1;
  T d = EGCD(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
template <typename T>
inline T NumOfDivisor(T n) {
  long long cnt = 0;
  int square_root = (int)sqrt(n) + 1;
  for (int i = 1; i < square_root; i++) {
    if (n % i == 0 && i * i != n) cnt += 2;
    if (n % i == 0 && i * i == n) cnt++;
  }
  return cnt;
}
template <typename T>
string to_string(T const &value) {
  stringstream sstr;
  sstr << value;
  return sstr.str();
}
template <class T1, class T2, class T3, class T4>
int lcs(T1 X, T2 Y, T3 m, T4 n) {
  int L[m + 1][n + 1];
  int i, j;
  for (i = 0; i <= m; i++) {
    for (j = 0; j <= n; j++) {
      if (i == 0 || j == 0)
        L[i][j] = 0;
      else if (X[i - 1] == Y[j - 1])
        L[i][j] = L[i - 1][j - 1] + 1;
      else
        L[i][j] = max(L[i - 1][j], L[i][j - 1]);
    }
  }
  return L[m][n];
}
template <typename T>
inline T scan(T &n) {
  n = 0;
  bool negative = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') negative = 1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    n = n * 10 + c - 48;
    c = getchar();
  }
  if (negative) n = ~(n - 1);
}
template <typename T>
void print(T n) {
  if (n < 0) {
    putchar('-');
    n = -n;
  }
  if (!n) {
    putchar('0');
    putchar('\n');
    return;
  }
  char buff[22];
  int len = 0;
  while (n) buff[len++] = n % 10 + 48, n /= 10;
  for (int i = len - 1; i >= 0; i--) putchar(buff[i]);
  putchar('\n');
}
template <typename T>
void Print(T n) {
  if (n < 0) {
    putchar('-');
    n = -n;
  }
  if (!n) {
    putchar('0');
    return;
  }
  char buff[22];
  int len = 0;
  while (n) buff[len++] = n % 10 + 48, n /= 10;
  for (int i = len - 1; i >= 0; i--) putchar(buff[i]);
}
string s;
int len;
long long dp[200005][3];
long long solve(int ind, int sum) {
  if (ind == len) return 0;
  long long &ret = dp[ind][sum];
  if (~ret) return ret;
  long long val = s[ind] - '0';
  ret = 0;
  if (val % 3 == 0) {
    ret = max(ret, solve(ind + 1, 0) + 1);
  }
  if (sum and (val + sum) % 3 == 0) {
    ret = max(ret, solve(ind + 1, (val + sum) % 3) + 1);
  } else if (sum and (val + sum) % 3) {
    ret = max(ret, solve(ind + 1, (val + sum) % 3));
  }
  if (val % 3) ret = max(ret, solve(ind + 1, val % 3));
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(0);
  cin >> s;
  len = s.size();
  memset(dp, -1, sizeof dp);
  print(solve(0, 0));
  return 0;
}