aboutsummaryrefslogtreecommitdiff
path: root/21-04-2022(Div.4)/E.cpp
blob: 7fac1a50f611f8068b905cc39095c35613521485 (plain)
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
#include<bits/stdc++.h>

using namespace std;

int main(){
  int tt, n, count;
  cin >> tt;
  while(tt--){
    string str;
    cin >> n;
    count = 0;
    vector<string> v(n);
    for(int i = 0; i < n; i++){
      cin >> v[i];
    }
    for(int i = 0; i < v.size(); i++){
      for(int j = i+1; j < v.size()-1; j++){
        if(v[i][0] != v[j][0] || v[i][1] != v[j][1]){
          count++;
        }
      }
    }
    cout << count << endl;
  }
}