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 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

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

Powered by Blogger.