Lucky four codechef solution
t=int(input())
a=str(4)
for i in range(t):
x=str(input())
count=0
for j in x:
if j==a:
count=count+1
print(count)
Lucky four codechef solution
t=int(input())
a=str(4)
for i in range(t):
x=str(input())
count=0
for j in x:
if j==a:
count=count+1
print(count)
lucky four codechef
#include <iostream>
using namespace std;
int main() {
// your code goes here
int t,number,count,rem;
std::cin >> t;
for (int i = 0; i < t; i++) {
cin >> number;
while(number != 0){
rem = number % 10;
if (rem == 4){
count++;
}
number /= 10;
}
std::cout << count << std::endl;
count = 0;
}
return 0;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us