Skip to content

Commit 70a46bb

Browse files
authored
Create VILTRIBE.cpp
1 parent c935822 commit 70a46bb

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

Codeshef/VILTRIBE.cpp

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#include <stdio.h>
2+
#include <iostream>
3+
using namespace std;
4+
5+
int main(){
6+
int T;
7+
cin>>T;
8+
while(T--){
9+
char str[100007];
10+
char t='0',x='0',y='0';
11+
cin>>str;
12+
int i=0,ta=0,tb=0,dot=0;
13+
t=str[0];
14+
for(i=0;t!='\0';i++){
15+
t=str[i+1];
16+
}
17+
t='0';
18+
for(int j=0;j<i;j++){
19+
t=str[j];
20+
if(t=='A'){
21+
ta++;
22+
if(x=='A')y='A';
23+
else {x='A';dot=0;}
24+
}
25+
26+
else if(t=='B'){
27+
tb++;
28+
if(x=='B')y='B';
29+
else {x='B';dot=0;}
30+
}
31+
32+
else if(t=='.'){
33+
dot++;
34+
}
35+
36+
if(x=='A' && y=='A'){
37+
ta = ta + dot;
38+
y='0';
39+
dot=0;
40+
}
41+
42+
if(x=='B' && y=='B'){
43+
tb = tb + dot;
44+
y='0';
45+
dot=0;
46+
}
47+
48+
}
49+
50+
cout<<ta<<" "<<tb<<endl;
51+
52+
}
53+
54+
return 0;
55+
}
56+

0 commit comments

Comments
 (0)