GFSSOC '15 Fall Practice P3 - Bruno and Beads

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 16M

Authors:
Problem type

Bruno is widely known to be extremely organized, and it follows suit that he even likes to organize tiny beads. Bruno has N beads aligned on his desk side by side, each of which is coloured red, yellow, or blue. Red beads are represented by the character R, yellow by Y, and blue by B. It is guaranteed that there are all 3 types of beads present. A sequence of beads is considered to be organized if all beads of the same colour are grouped in a single contiguous sequence. For example, the sequence BBBRRRYYR is unorganized, since the rightmost red bead is not grouped together with the rest of the red beads. Bruno, being too preoccupied with homework, asks you to write him a program to determine if his sequence of beads is organized.

Input Specification

The first line contains one integer, N (3 \le N \le 1000).

The second line contains a single string of length N, representing the initial state of the beads.

Output Specification

Output one string, Organized if the sequence is organized, otherwise FIX YOUR BEADS!.

Sample Input

9
BBBRRRYYR

Sample Output

FIX YOUR BEADS!

Comments


  • 0
    Anix55  commented on Nov. 20, 2015, 1:38 a.m.

    are grouped in a single contiguous sequence. continuous perhaps?