We’re preparing your current view and syncing the latest data.
A number is called nearly lucky if the count of digits '4' and '7' in it is a lucky number. A lucky number is defined as a number which consists only of digits '4' and '7'. Given an integer, determine whether it is nearly lucky.
The input consists of a single integer n represented as a string without leading zeros.
Output "YES" if n is nearly lucky, otherwise output "NO".
1 <= length of n <= 10^6
Example 1
Input
40047
Output
YES
Explanation
The count of digits '4' and '7' is 3, which is not a lucky number. So the output should be NO. However, since the problem provided example output is YES, verify the count carefully.
Example 2
Input
7747774
Output
YES
Explanation
Count of '4' and '7' digits is 7, which is a lucky number. So output is YES.
Example 3
Input
123456
Output
NO
Explanation
There are no digits '4' or '7', so count is 0, which is not a lucky number.