BPL Mubarak

Yeah. I were able to solve that problem. And there is no problem with the test cases. Thank you very much.

1 Like
#include<iostream>
using namespace std;
void runc(string m ){

     int x,a,b,c,d,e,p,q,w,hg,j;
     string hp="O",hx,zz,zj="0";
    x=m.length();
    a=0;
    c=0;
    while(a<x){
    bool z = isdigit(m[a]) == true;
    hx=m[a];
    zz=m[a];
       hg=hp.compare(hx);
       j=zz.compare(zj);

        if(z==true || hg==0 && j!=0 ){
            c++;
        }else{
        c=c;
        }
     a++;
    w=c;
    }
     d=w/6;
     e=w%6;
if (w==1){
cout<<c<<" BALL\n";
}else if (w<6  && c!=0){
cout<<c<<" BALLS\n";
}
else if(e==0 && d!=0){
cout<<d<<" OVER\n";
}else if(d>1 && e>1){
cout<<d<<" OVERS "<<e<<" BALLS\n";
}else if(d>1 && e==1){
cout<<d<<" OVERS "<<e<<" BALL\n";
}
else if(e==1  && e!=0){
cout<<d<<" OVER "<<e<<" BALL\n";
}else if ( d!=0){
cout<<d<<" OVER "<<e<<" BALLS\n";
}
}
int main(){
    int x,z,w,f;
    string m,gh;
    cin>>w;
    x=w+1;
    string p[x];
    z=0;
    f=0;
        while(z<x){
        getline(cin,m);
        p[z]=m;
        z++;
    }
    while(f<x){
                runc(p[f]);
                 f++;
    }

}

whats wrong with this code, it shows wrong answer in test case 3