-
Notifications
You must be signed in to change notification settings - Fork 590
/
Copy pathBPL Mubarak!.cpp
63 lines (59 loc) · 1.06 KB
/
BPL Mubarak!.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
read:
while(t--)
{
string s;
cin>>s;
int cnet=0,ov=0;
int i,ss=s.size();
for(i=0; i<ss; i++)
{
if(s[i]=='N' || s[i]=='W' || s[i]=='D')
{
continue;
}
else
{
cnet++;
}
if(cnet==6)
{
cnet=0;
ov++;
}
}
string ball,ovr;
if(cnet==1)
{
ball="BALL";
}
else if(cnet>1)
{
ball="BALLS";
}
if(ov==1)
{
ovr="OVER";
}
else if(ov>1)
{
ovr="OVERS";
}
if(ov!=0 && cnet!=0)
{
cout<<ov<<" "<< ovr<<" "<<cnet<<" "<<ball<<endl;
}
else if(ov!=0 && cnet==0)
{
cout<<ov<<" "<<ovr<<endl;
}
else
cout<<cnet<<" "<<ball<<endl;
}
return 0;
}