We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c935822 commit 70a46bbCopy full SHA for 70a46bb
Codeshef/VILTRIBE.cpp
@@ -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
45
46
47
48
49
50
+ cout<<ta<<" "<<tb<<endl;
51
52
53
54
+ return 0;
55
+}
56
0 commit comments