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

RESTful APIs with CRUD Operations in Laravel 12| (2025)

  RESTful APIs serve as the foundation of modern web development. They follow a set of rules called Representational State Transfer (REST) t...

Powered by Blogger.