-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path110A.cpp
More file actions
40 lines (40 loc) · 696 Bytes
/
Copy path110A.cpp
File metadata and controls
40 lines (40 loc) · 696 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <iostream>
#include <string>
using namespace std;
int main()
{
string num;
cin>>num;
long long int counter4=0;
long long int counter7=0;
for(long long int i=0;i<=num.size();i++)
{
if((num[i]=='4'))
{
counter4++;
}
else if((num[i]=='7'))
{
counter7++;
}
}
if((counter4+counter7)==num.size()&&counter4!=0 && counter7!=0)
{
if(counter4+counter7==7||counter4+counter7==4)
{
cout<<"YES";
}
else
{
cout<<"NO";
}
}
else if(counter4+counter7==7||counter4+counter7==4)
{
cout<<"YES";
}
else
{
cout<<"NO";
}
}