MEENA_001 Editorial

Practice

Author: Yogesh Deolalkar
Tester: Ram Agrawal
Editorialist: Prathamesh Sogale

DIFFICULTY:

SIMPLE, EASY.

PREREQUISITES:

Math

PROBLEM:

Meena set off with great zeal to the “Fun Fair 2022”. There were numerous activities in the fair, though Meena liked the Candy game. Delicious candies were wrapped in colourful foiled sheets with some random numbers on each of the candies. The game coordinators then formed many groups of few candies together, such that each candy group makes an integer and hid them all around the room. The objective of the game is that the players should look for the occurrences of number four anywhere in the integers (candy groups) placed in the room.
Meena started off with the game where there are many such integers, for each of them she should calculate the number of occurrences of the digit 4 in the decimal representation. Can you please help him in succeeding the game?

QUICK EXPLANATION:

Count the number of occurances of digit 4 .

SOLUTIONS:

Setter's Solution

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

Tester's Solution

T = int(input())
for i in range(T):
s = int(input())
T = str(s)
ans =(T.count(“4”))
print(ans)