#include <bits/stdc++.h>
long long mod = 1000000007;
using namespace std;
long long power(long long a, long long b) {
  long long ans = 1;
  while (b > 0) {
    if (b & 1) {
      ans = (ans * a) % mod;
    }
    a = (a * a) % mod;
    b >>= 1;
  }
  return ans;
}
long long max(long long a, long long b) { return a > b ? a : b; }
bool r(pair<long long, long long> p1, pair<long long, long long> p2) {
  return (p2.first < p1.first);
}
long long min(long long a, long long b) { return a < b ? a : b; }
const int N = 100005;
void solve() {
  string s;
  cin >> s;
  long long cnt = 0;
  for (long long i = 0; i < s.length(); i++) {
    if (s[i] == '4' || s[i] == '7') cnt++;
  }
  if (cnt == 4 || cnt == 7)
    cout << "YES" << '\n';
  else
    cout << "NO" << '\n';
}
int main() {
  long long t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
