Loading...
MU CSE Fest 23 Balloon Challenge
Time: 1 s
Memory: 125 MB
The CSE Fest 2023 at Metropolitan University is in full swing, and the campus is bustling with excitement. A key attraction is the grand decoration with colorful balloons at the programming contest venue. Each balloon is colored either red, green, or blue, creating a vibrant and welcoming atmosphere for the programmers.

As a part of a fun challenge during the fest, the participants are given a task to analyze the balloon arrangement. The arrangement is considered perfectly harmonious if the number of red, green, and blue balloons is all the same.

You are given an array B representing the sequence of balloons, where each balloon is represented by a character: 'R' for red, 'G' for green, and 'B' for blue. Your task is to determine if the balloon arrangement is harmonious.
Input
The first line of input contains a single integer T (1 ≤ T ≤ 100), representing the number of test cases.
Each test case begins with a line containing a single integer N (1 ≤ N ≤ 10^4), the number of balloons in that test case.
The following line contains a string B of length N representing the sequence of balloons, where each character is either 'R', 'G', or 'B'.
Constraint
1 ≤ length of B ≤ 10^4
Each element of B is either 'R', 'G', or 'B'.
Output
For each test case, print the case no(starting from 1), and print "Harmonious" if the number of red, green, and blue balloons is the same. Otherwise, print "Not Harmonious".
Examples
Input
Output
2
9
RBRGBRGBG
7
RRGBBGG
Case 1: Harmonious
Case 2: Not Harmonious
Problem Info
Problem ID 203
Time Limit 1000 ms
Memory Limit 128000 KB
Moderators abujafar492
Statistics
Submit
You need to Login or Registration for submit your solution