Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- bool lucky(int n){
- if(!n)
- return false;
- while(n){
- int d = n % 10;
- if((d != 4) && (d != 7))
- return false;
- n /= 10;
- }
- return true;
- }
- signed main()
- {
- string s;
- cin >> s;
- int cnt = 0;
- for(int i = 0; i < s.size(); i++){
- if((s[i] == '4') || (s[i] == '7'))
- cnt++;
- }
- cout << ((lucky(cnt)) ? "YES" : "NO") << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement