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

t = int(input())
record = []

for i in range(0, t):
s = input()
record.append(s)

if s == “w” or s == “W”:
record.remove(s)
if s == “n” or s == “N”:
record.remove(s)
if s == “D” or s == “d”:
record.remove(s)

over = len(record) // 6
ball = len(record) % 6

if over == 1 and ball == 1:
print(over, “OVER”, ball, “BALL”)
elif over == 1 and ball > 1:
print(over, “OVER”, ball, “BALLS”)
elif over > 1 and ball == 1:
print(over, “OVERS”, ball, “BALL”)
elif over == 0 and ball == 1:
print(ball, “BALL”)
elif over == 0 and ball > 1:
print(ball, “BALLS”)
elif over == 1 and ball == 0:
print(over, “OVER”)
elif over > 1 and ball == 0:
print(over, “OVERS”)
else:
print(over, “OVERS”, ball, “BALLS”)

What’s wrong with my code?