#include <bits/stdc++.h>
using namespace std;
int main() {
  string filter;
  getline(cin, filter);
  int count = 0;
  for (int i = 0; i < filter.size(); i++) {
    if ((int)filter[i] == 55 || (int)filter[i] == 52) {
      count++;
    }
  }
  if (count == 4 || count == 7)
    cout << "YES";
  else
    cout << "NO";
}
