blob: d807b1ab39a28b7f27094e2083793b3b632634e6 (
plain)
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
|
#include<bits/stdc++.h>
using namespace std;
bool isLucky(string s) {
for(int i = 0; i < s.size(); i++) {
if(s[i] != '4' && s[i] != '7') {
return false;
}
}
return true;
}
int main () {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long n;
cin >> n;
string s = to_string(n);
int cnt = 0;
for(auto ch : s) {
if(ch == '4' || ch == '7') {
cnt ++;
}
}
if(isLucky(to_string(cnt))) {
cout << "YES";
} else {
cout << "NO";
}
}
|