GFSSOC '15 Fall Practice P3 - Bruno and Beads
View as PDFBruno is widely known to be extremely organized, and it follows suit that he even likes to organize tiny beads. Bruno has 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, (
).
The second line contains a single string of length , 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
are grouped in a single contiguous sequence. continuous perhaps?
contiguous