1867 Nearly Lucky Number
Submit solution
Points:
100
Time limit:
1.0s
Memory limit:
32M
Problem types
Allowed languages
C, C++, Java, Python
Description
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky digits in it is a lucky number. He wonders whether number is a nearly lucky number.
Input
The input contains some integers whthin 1 and 10^120.
Output
Print on the single line "YES" if the number is a nearly lucky number. Otherwise, print "NO" (without the quotes).
Sample
Input
40047
7747774
1000000000000000000
Output
NO
YES
NO
Comments