#include <bits/stdc++.h>
using namespace std;
int main() {
  long long k = 0;
  string s;
  cin >> s;
  int pos = s.find_first_of("47");
  while (pos + 1) {
    k++;
    pos = s.find_first_of("47", pos + 1);
  }
  if (!k) {
    cout << "NO";
    return 0;
  }
  while (k) {
    if (k % 10 != 7 && k % 10 != 4) {
      cout << "NO";
      return 0;
    }
    k /= 10;
  }
  cout << "YES";
  return 0;
}
