Codeforces Nearly Lucky Number
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
int main()
{
ios_base::sync_with_stdio(false);
LL n;
while(cin >> n)
{
LL cnt=0;
while(n)
{
if(n%10 == 4 or n%10==7) cnt++;
n/=10;
}
if(cnt==4 or cnt==7 or cnt==47 or cnt==744) cout << "YES\n";
else cout << "NO\n";
}
return 0;
}
using namespace std;
typedef long long LL;
int main()
{
ios_base::sync_with_stdio(false);
LL n;
while(cin >> n)
{
LL cnt=0;
while(n)
{
if(n%10 == 4 or n%10==7) cnt++;
n/=10;
}
if(cnt==4 or cnt==7 or cnt==47 or cnt==744) cout << "YES\n";
else cout << "NO\n";
}
return 0;
}
Comments
Post a Comment