1 #include<stdio.h>
2 #include<iostream>
3 using namespace std;
4 int winA=0,loseA=0,equall=0;
5 int Acount[3]={0,0,0};
6 int Bcount[3]={0,0,0};
7 void Judge(char A,char B)
8 {
9 if(A==‘B‘&&B==‘C‘)
10 {
11 winA++;
12 Acount[0]++;
13 }
14 else if(A==‘C‘&&B==‘J‘)
15 {
16 winA++;
17 Acount[1]++;
18 }
19 else if(A==‘J‘&&B==‘B‘)
20 {
21 winA++;
22 Acount[2]++;
23 }
24 else if(B==‘B‘&&A==‘C‘)
25 {
26 loseA++;
27 Bcount[0]++;
28 }
29 else if(B==‘C‘&&A==‘J‘)
30 {
31 loseA++;
32 Bcount[1]++;
33 }
34 else if(B==‘J‘&&A==‘B‘)
35 {
36 loseA++;
37 Bcount[2]++;
38 }
39 else
40 equall++;
41 }
42
43
44 void Print(int num)
45 {
46 if(num==0)
47 printf("B");
48 else if(num==1)
49 printf("C");
50 else if(num==2)
51 printf("J");
52 }
53 int main(int argc, char** argv) {
54 int N;
55 scanf("%d",&N);
56
57 while(N--)
58 {
59 char A,B;
60 cin>>A>>B;
61 // scanf("%c%c",&A,&B);
62 Judge(A,B);
63 }
64 int MostwinA=0,MostwinB=0;
65 if(Acount[0]>=Acount[1]&&Acount[0]>=Acount[2])
66 MostwinA=0;
67 else if(Acount[1]>=Acount[0]&&Acount[1]>=Acount[2])
68 MostwinA=1;
69 else if(Acount[2]>=Acount[0]&&Acount[2]>=Acount[1])
70 MostwinA=2;
71 if(Bcount[0]>=Bcount[1]&&Bcount[0]>=Bcount[2])
72 MostwinB=0;
73 else if(Bcount[1]>=Bcount[0]&&Bcount[1]>=Bcount[2])
74 MostwinB=1;
75 else if(Bcount[2]>=Bcount[0]&&Bcount[2]>=Bcount[1])
76 MostwinB=2;
77 printf("%d %d %d\n",winA,equall,loseA);
78 printf("%d %d %d\n",loseA,equall,winA);
79 Print(MostwinA);
80 putchar(‘ ‘);
81 Print(MostwinB);
82
83 }