#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  map<char, int> m;
  for (long long i = 0; i < s.size(); i++) {
    m[s[i]]++;
  }
  int flag = 0;
  long long c = m['4'] + m['7'], r;
  long long n = c;
  while (c > 0) {
    r = c % 10;
    if (r != 4 && r != 7) {
      flag = 1;
      break;
    }
    c /= 10;
  }
  if (flag == 0 && n > 0)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
