Find Your Solution Here

Codeforces

codeforces solution 110A – Nearly Lucky Number

Problem link—110A – Nearly Lucky Number
/*

Harun-or-Rashid

CSEDU-23rd Batch

*/

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int i,cnt=0;
    char s[20];
    scanf("%s",s);
    for(i=0; i<strlen(s); i++)
    {
        if(s[i]=='4'||s[i]=='7')
        {
            cnt++;
        }
    }
    if(cnt==4||cnt==7)
        printf("YES\n");
    else
        printf("NO\n");
    return 0;
}

3 Comments

  1. Tasnim Ahmed

    I think the solution is wrong. Can you please check it again??

  2. MD SHAKIBUL HOSSAIN SIKDER

    your logic is right

Leave a Reply