class Solution {
public:
string q[10];
int countPoints(string rings) {
char c;
for (int i = 1; i < rings.size(); i += 2)
q[rings[i] - '0'] += rings[i - 1];
int res = 0;
for (int i = 0; i < 10; i ++) {
bool b = false, r = false, g = false;
if (q[i].empty()) continue;
for (auto c: q[i]) {
if (c == 'B') b = true;
else if (c == 'R') r = true;
else if (c == 'G') g = true;
}
if (b && r && g) res ++ ;
}
return res;
}
};