#include<iostream>
using namespace std;
int main()
{
long long int x; // input for T (denoting the number of integers in Kostya's list)
long long int i; // iterating input loop for T times
long long int m; // variable for splitting input into digits
long long int d; // for checking if digit is 4 or not
int c=0; // counter for digit 4
cin>>x;
long long int g[x]; array for storing final number of occurrences of 4 for each input line
for(i=1;i<=x;i++)
{
cin>>m;
while(m!=0)
{
d = m%10;
if(d==4)
c++;
g[i-1]=c;
m=m/10;
}
c=0;
}
// loop for printing T lines
int f;
for(f=0;f<x;f++)
{
cout<<g[f]<<endl;
}
}
Here is my code submission for Problem Code: LUCKFOUR
I am failing constraint subtask 1 , how to proceed further I have tried changing my data types to long.