Codeforces 110A Nearly Lucky Number solution in CPP
#include<bits/stdc++.h>
using namespace std;
int main()
{
string a;
int c=0,z=0;
cin>>a;
for(int i=0;i<a.size();i++) {
if(a[i]=='4'||a[i]=='7')//Codeforces 110A Nearly Lucky Number solution in CPP
c++;
}
if(c==4||c==7)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}




