ITS AWSOME

0

0 votes
Problem

Quan_Lank loves awsome numbers. Awsome numbers are the positive integers whose decimal representations contain only the awsome digits 4 and 7. For example, numbers 7, 74, 4 are awsome and 5, 137, 4467 are not. Unfortunately, not all numbers are awsome. Quan_Lank calls a number nearly awsome if the number of awsome digits in it is a awsome number. He wonders whether number n is a nearly awsome number.

INPUT :

First line of Input contains no. of test cases T(T<=100). Each test case contains one line having a single integer n (1<=n<=10^18).

OUTPUT :

For each test case print on the single line "YES" if n is a nearly awsome number. Otherwise, print "NO" (without the quotes).

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?