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).

SAMPLE INPUT
2
40047
4777

SAMPLE OUTPUT
NO
YES
for i in range(int(raw_input())):
    s=raw_input()
    S=0
    S=s.count("4")+s.count("7")
    if str(S).count("4")+str(S).count("7")==len(str(S)):
    	print("YES")
    else:
        print("NO")