Codeforces 110A. Nearly Lucky Number Solution

Solve in C++:

#include<iostream>
#include<string.h>
using namespace std;
 main()
{
    char  s[1000];
    int l,i,f=0;;
    while(cin>>s)
    {
         l=strlen(s);
        for(i=0; i<l; i++)
        {
            if((s[i]=='4')||(s[i]=='7'))
            {
            f++;
            }
        }
        if(f==4||f==7)
        cout<<"YES"<<endl;
        else
        cout<<"NO"<<endl;
        f=0;
    }

}

No comments

Most View Post

Recent post

Codeforces Round 925 (Div. 3) 1931D. Divisible Pairs Solution

    Problem Link  :   https://codeforces.com/contest/1931/problem/D S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. ...

Powered by Blogger.