I tried solving the question by finding if the substring(multiples of 4) has an occurence in the original string. I tried using Find class in C++ strings, but its giving me WA.
Here’s my C++ Code
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t–)
{
string ans,s;
int i,j;
int check=0;
cin>>s;
for(i=0;i<=96;i+=4)
{
string cur=to_string(i);
size_t found=s.find(cur);
if(found!=string::npos)
{
check=1;ans=cur;break;
}
}
if(check)
cout<<"YES "<<ans<<endl;
else
cout<<"NO"<<endl;
}
}