#include <bits/stdc++.h>
using namespace std;
long long int h = 0;
void dfs1(long long int x, vector<long long int> child[], long long int vi[]) {
  vi[x] = 1;
  long long int i;
  for (i = 0; i < child[x].size(); ++i) {
    if (vi[child[x][i]] == 0) dfs1(child[x][i], child, vi);
  }
}
void dfs(long long int x, vector<long long int> par[],
         vector<long long int> child[], long long int vi[]) {
  vi[x] = 1;
  long long int i, j, k;
  for (i = 0; i < child[x].size(); ++i) {
    if (vi[child[x][i]] == 0) {
      dfs1(child[x][i], child, vi);
    }
  }
  if (par[x].size() == 0 || (par[x].size() == 1 && vi[par[x][0]] == 1)) h++;
  for (i = 0; i < par[x].size(); ++i) {
    if (vi[par[x][i]] == 0) {
      dfs(par[x][i], par, child, vi);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int i, j, k, n, s1 = 0;
  string s;
  cin >> s;
  for (i = 0; i < s.length(); ++i) {
    if (s[i] == '4' || s[i] == '7') s1++;
  }
  if (s1 == 0) {
    cout << "NO";
    return 0;
  }
  while (s1 != 0) {
    if (s1 % 10 == 4 || s1 % 10 == 7) {
      s1 /= 10;
    } else {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
  return 0;
}
