#include <bits/stdc++.h>   using namespace std;   int main() {     long long n;     while (cin >> n) {       bool flag = false;       int sum = 0;       while (n) {         if (n % 10 == 4 || n % 10 == 7)           n /= 10, sum++;         else           n /= 10;       }       if ((sum == 4 || sum == 7))         cout <<  YES  << endl;       else         cout <<  NO  << endl;     }   }   