#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  long long count = 1, ans = 1, done = 1;
  cin >> s;
  for (long long i = 0; i < s.length(); i++) {
    if (s[i] - '0' + s[i + 1] - '0' == 9) {
      i += 2;
      count = 2;
      done = 0;
      while (s[i - 2] == s[i++]) count++;
      i -= 2;
    }
    if (count % 2 & !done) {
      ans *= ((count + 1) / 2);
      done = 1;
    }
  }
  cout << ans;
  return 0;
}
