-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcolor.cpp
More file actions
38 lines (37 loc) · 721 Bytes
/
color.cpp
File metadata and controls
38 lines (37 loc) · 721 Bytes
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
26
27
28
29
30
31
32
33
34
35
36
37
38
#include<iostream>
#include<algorithm>
#include<stdlib.h>
#include<iomanip>
#include<strings.h>
#define size 50
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
char a[100000];
int l,r=0,g=0,b=0;
cin>>l;
cin>>a;
for(int i=0;i<l;i++)
{
if(a[i]=='R')
r++;
else if(a[i]=='G')
g++;
else if(a[i]=='B')
b++;
}
if(r>=g&&r>=b)
cout<<l-r<<endl;
else if(g>r&&g>b)
cout<<l-g<<endl;
else if(b>g&&b>r)
cout<<l-b<<endl;
else if(r==l||g==l||b==l)
cout<<"0"<<endl;
}
return 0;
}