#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FAST1 ios_base::sync_with_stdio(false);
#define FAST2 cin.tie(NULL);
//red blue yellow
//orange purple green gray
//Red + Yellow = Orange
//Red + Blue = Purple
//Yellow + Blue = Green
//Red + Yellow + Blue = Gray
//U = Uncolored R = Red Y = Yellow B = Blue O = Orange
//P = Purple G = Green A = Gray
int main(){
FAST1;
FAST2;
ll t;
cin>>t;
for(ll z=1;z<=t;z++){
int r=0,y=0,b=0;
int n;cin>>n;
string s;cin>>s;
int flag=0;
for(int i=0;i<s.length();i++)
{
if(s[i]=='R' or s[i]=='O' or s[i]=='P' or s[i]=='A')
{
if(r==0)
r=1;
else if(r>=1)
{
if(s[i-1]=='R' or s[i-1]=='O' or s[i-1]=='P' or s[i-1]=='A' or s[i-1]=='U')
flag=0;
else
r+=1;
}
}
if(s[i]=='Y' or s[i]=='O' or s[i]=='G' or s[i]=='A')
{
if(y==0)
y=1;
else if(y>=1)
{
if(s[i-1]=='Y' or s[i-1]=='O' or s[i-1]=='G' or s[i-1]=='A' or s[i-1]=='U')
flag=0;
else
y+=1;
}
}
if(s[i]=='B' or s[i]=='P' or s[i]=='G' or s[i]=='A')
{
if(b==0)
b=1;
else if(b>=1)
{
if(s[i-1]=='B' or s[i-1]=='P' or s[i-1]=='G' or s[i-1]=='A' or s[i-1]=='U')
flag=0;
else
b+=1;
}
}
}
if(r+y+b>0)
cout<<"Case #"<<z<<": "<<r+y+b<<"\n";
else
cout<<"Case #"<<z<<": "<<"1"<<"\n";
}
}
I’m