#CCBCHMOT0000043. Số gần may mắn (Nearly Lucky Number)
Số gần may mắn (Nearly Lucky Number)
Nearly Lucky Number
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
A lucky digit is 4 or 7. Count how many lucky digits occur in positive n. Print YES if this count is a positive integer consisting only of lucky digits; otherwise print NO. Since n has at most 19 digits, this is equivalent to count 4 or 7.
Input
One positive integer n.
Output
Print exactly YES or NO.
Subtasks
- Subtask 1 (20%): .
- Subtask 2 (30%): .
- Subtask 3 (50%): .
Examples
Example 1
Input
40047
Output
NO
Explanation
There are three lucky digits; 3 is not lucky.
Example 2
Input
7747774
Output
YES
Explanation
All seven digits are lucky, and count 7 is itself lucky.