Karan likes the number 4 very much.

Impressed by the power of this number, Karan has begun to look for occurrences of four anywhere. He has a list of T integers, for each of them he wants to calculate the number of occurrences of the digit 4 in the decimal representation. He is too busy now, so please help him.

------ Input Format ------ 

The first line of input consists of a single integer T, denoting the number of integers in Karan's list.

Then, there are T lines, each of them contain a single integer from the list.

------ Output Format ------ 

Output T lines. Each of these lines should contain the number of occurrences of the digit 4 in the respective integer from Karan's list.

------ Constraints ------ 

1 ≤ T ≤ 10^{5}
(Subtask 1): 0 ≤ Numbers from the list  ≤ 9 - 33 points.
(Subtask 2): 0 ≤ Numbers from the list  ≤ 109 - 67 points.

----- Sample Input 1 ------ 
5
447474
228
6664
40
81

----- Sample Output 1 ------ 
4
0
1
1
0

Difficulty: EASY

Solutions:
for i in range(int(input())):
	x = str(input())
	print(x.count('4'))


for _ in range(int(input())):
	print(input().count('4'))


from collections import Counter
N = int(input())
for i in range(N):
	list1 = list(map(int, input()))
	x = Counter(list1)
	count = 0
	for i in x.elements():
		if i == 4:
			count += 1
	print(count)


t = int(input())
for i in range(t):
	x = int(input())
	co = 0
	while x > 0:
		r = x % 10
		if r == 4:
			co = co + 1
		x = x // 10
	print(co)


t = int(input())
for i in range(t):
	n = int(input())
	c = 0
	tem = n
	while n != 0:
		r = n % 10
		if r == 4:
			c += 1
		n = n // 10
	print(c)


t = int(input())
for i in range(t):
	num = input()
	x = [i for i in num]
	print(x.count('4'))


T = int(input())
lis = []
for i in range(T):
	x = int(input())
	lis.append(x)
for i in range(T):
	y = str(lis[i])
	print(y.count('4'))


for _ in range(int(input())):
	t = int(input())
	a = str(t)
	c = 0
	for i in range(len(a)):
		if a[i] == '4':
			c += 1
	print(c)


def count_fours(num):
	count = 0
	while num > 0:
		if num % 10 == 4:
			count += 1
		num //= 10
	return count
t = int(input())
for i in range(t):
	n = int(input())
	print(count_fours(n))


for i in range(int(input())):
	x = int(input())
	coun = 0
	while x > 0:
		if x % 10 == 4:
			coun += 1
		x = x // 10
	print(coun)


t = int(input())
for i in range(t):
	num = int(input())
	occurences = 0
	while num != 0:
		if num % 10 == 4:
			occurences = occurences + 1
		num = num // 10
	print(occurences)


for i in range(int(input())):
	s = input()
	print(s.count('4'))


for i in range(int(input())):
	t = int(input())
	t = str(t)
	print(t.count('4'))


t = int(input())
for i in range(t):
	n = input()
	c = 0
	for j in range(len(n)):
		if n[j] == '4':
			c += 1
	print(c)


for asdioh in range(int(input())):
	T = input()
	print(len(['' for i in range(len(T)) if T[i] == '4']))


no_of_input = int(input())
for _ in range(no_of_input):
	sample = map(int, input())
	sample = list(sample)
	print(sample.count(4))


for i in range(int(input())):
	print(input().strip().count('4'))


T = int(input())
for _ in range(T):
	X = input()
	print(X.count('4'))


from collections import Counter
t = int(input())
count = 0
while t > 0:
	str = input()
	letters = Counter(str)
	print(letters['4'])
	t = t - 1


t = int(input())
while t != 0:
	n = int(input())
	s = str(n)
	c = 0
	for i in s:
		if i == '4':
			c += 1
	print(c)
	t -= 1


T = int(input())
for _ in range(T):
	num = int(input())
	count = str(num).count('4')
	print(count)


t = int(input())
for i in range(t):
	n = int(input())
	c = 0
	while n != 0:
		rem = n % 10
		if rem == 4:
			c += 1
		n = n // 10
	print(c)


from collections import Counter
for _ in range(int(input())):
	a = input()
	c = Counter(a)
	if '4' in c.keys():
		print(c['4'])
	else:
		print(0)


T = int(input())
for i in range(T):
	n = int(input())
	a = str(n)
	if '4' in a:
		res = a.count('4')
		print(res)
	else:
		print(0)


T = int(input())
for i in range(T):
	a = int(input())
	c = 0
	while a > 0:
		rem = a % 10
		if rem == 4:
			c = c + 1
		a = a // 10
	print(c)


t = int(input())
for i in range(t):
	k = list(str(input()))
	print(k.count('4'))


for _e in range(int(input())):
	print(input().count('4'))


t = int(input())
for i in range(t):
	lst = input()
	c = 0
	for i in lst:
		if i == '4':
			c += 1
	print(c)


for i in range(int(input())):
	n = input()
	print(n.count('4'))


for _ in range(int(input())):
	n = input()
	count = 0
	for i in range(len(n)):
		if n[i] == '4':
			count += 1
	print(count)


def Convert(string):
	lst = []
	lst[:0] = string
	return lst
T = int(input())
for _ in range(T):
	num = input()
	print(num.count('4'))


T = int(input())
for i in range(T):
	a = int(input())
	a = str(a)
	b = a.count('4')
	print(b)


t = int(input())
for i in range(t):
	j = input().count('4')
	print(j)


t = int(input())
for i in range(t):
	n = int(input())
	count = 0
	for i in str(n):
		if i == '4':
			count += 1
	print(count)


for i in range(int(input())):
	n = int(input())
	sum = 0
	c = 0
	while n != 0:
		r = n % 10
		if r == 4:
			c += 1
		n = n // 10
	print(c)


T = int(input())
count = 0
for i in range(T):
	X = str(input())
	print(X.count('4'))


for i in range(int(input())):
	num = input()
	print(num.count('4'))


for i in range(int(input())):
	a = input()
	print(a.count('4'))


t = int(input())
for i in range(t):
	st = input()
	l = list(st)
	d = l.count('4')
	print(d)


t = int(input())
for i in range(t):
	b = input()
	print(b.count('4'))


T = int(input())
c = 0
for i in range(T):
	x = str(input())
	for j in x:
		if j == '4':
			c = c + 1
	print(c)
	c = 0


tc = int(input())
while tc > 0:
	n = input()
	count = 0
	for i in range(0, len(n)):
		if n[i] == '4':
			count += 1
	print(count)
	tc -= 1


T = int(input())
lst = []
for i in range(T):
	lst.append(int(input()))
for i in lst:
	c = 0
	for j in str(i):
		if j == '4':
			c += 1
	print(c)


def Convert(string):
	lst = []
	lst[:0] = string
	return lst
T = int(input())
for _ in range(T):
	num = input()
	finnum = Convert(num)
	count = 0
	for i in finnum:
		if int(i) == 4:
			count += 1
	print(count)


t = int(input())
f = 4
r = 0
for h in range(t):
	n = input()
	for x in n:
		if f == int(x):
			r += 1
		else:
			None
	print(r)
	r = 0


for i in range(int(input())):
	a = input()
	j = 0
	for i in a:
		if i == '4':
			j += 1
	print(j)


t = int(input())
for i in range(t):
	n = input()
	c = 0
	l = list(n)
	for i in l:
		if i == '4':
			c += 1
	print(c)


t = int(input())
for i in range(t):
	x = list(input())
	print(x.count('4'))


t = eval(input())
while t:
	s = input()
	r = 0
	for i in s:
		if int(i) == 4:
			r += 1
	print(r)
	t -= 1


n = int(input())
x = []
for i in range(0, n):
	x.append(int(input()))
for j in x:
	c = 0
	k = str(j)
	for h in k:
		if h == '4':
			c += 1
	print(c)


t = int(input())
l = []
for i in range(t):
	l.append(int(input()))
for i in range(len(l)):
	count = 0
	while l[i] != 0:
		r = l[i] % 10
		if r == 4:
			count += 1
		l[i] = l[i] // 10
	print(count)


t = int(input())
for i in range(t):
	n = input()
	length = len(n)
	f = 0
	for j in range(length):
		if n[j] == '4':
			f += 1
	print(f)


for i in range(int(input())):
	l = []
	a = int(input())
	l.append(a)
	for i in l:
		a = [int(x) for x in str(i)]
		c = 0
		for k in a:
			if k == 4:
				c += 1
	print(c)


for i in range(int(input())):
	x = input()
	x = list(x)
	add = 0
	for j in x:
		x = int(j)
		if 4 == x:
			add += 1
	print(add)


l1 = list(map(lambda p: p.count('4'), [input() for i in range(int(input()))]))
for i in l1:
	print(i)


t = int(input())
for i in range(0, t):
	x = input()
	print(x.count('4'))


for i in range(int(input())):
	a = input('')
	c = 0
	for i in range(len(a)):
		if a[i] == '4':
			c = c + 1
	print(c)


T = int(input())
while T > 0:
	count = 0
	s = input()
	for i in s:
		if i == '4':
			count += 1
	print(count)
	T -= 1


testcase = int(input())
if 1 <= testcase <= 10 ** 5:
	for case in range(testcase):
		no_four = 0
		int_string = input()
		for single in int_string:
			if '4' == single:
				no_four += 1
		print(no_four)


k = int(input())
for s in range(k):
	o = int(input())
	a = []
	while o > 0:
		a.append(o % 10)
		o = o // 10
	print(a.count(4))