#P2080. ACSL 2021-2022 Senior Division Contest #1 Fibonacci Clock
ACSL 2021-2022 Senior Division Contest #1 Fibonacci Clock
ACSL’s version of Philippe Chretien’s “Fibonacci Clock” displays time by changing the colors displayed in squares, whose side lengths correspond to the first Fibonacci numbers ( and ). Given the colors of the squares on the clock face, you must output the time that is represented in format. The colors will be given to you as a single string of uppercase characters representing the lower x square, the upper x square, the x square, the x square, and the x square in that order. (See https://basbrun.com/2015/05/04/fibonacci-clock/.)

Each square has a color: red, green, blue, cyan, magenta, yellow, or white. All red squares represent only the number of hours; green squares represent only minutes; and blue squares represent only seconds. However, intersecting regions (in the Venn Diagram shown) are used to represent different values: yellow represents both hours and minutes; magenta represents both hours and seconds; and cyan represents both minutes and seconds. White squares are ignored.

For both minutes and seconds, the sum of the values of the lengths is multiplied by so that the number of minutes and seconds are in intervals of between and inclusive.
However, if the number of minutes or seconds is or more and/or if the number of hours is or more, change it to a valid time from to . For example, would become and would be .
In this modified version of the clock, the time displayed on the clock in the picture above is . The hours are represented by the red x square. The minutes are represented by the green x square , and the seconds are represented by the blue x and the blue x squares and .
For example, the illustrations below represent the first two sample inputs. The string “RWGBG” represents hour, minutes, and seconds. The string “RCMGB’ represents hours , minutes , and seconds or .

INPUT FORMAT
There are sets of data. Each set has a single -character string of possible uppercase characters, such as “RWGBG”. The possible letters are R, G, B, C, M, Y, and W. The order is the lower x , the upper x , the x , the x , and the × square. We guarantee that the input will represent a valid time from to .
OUTPUT FORMAT
For each line of data, print the time in hours, minutes, and seconds formatted as .
SAMPLE
INPUT
RWGBG
RCMGB
BYYGR
MRGBW
YYYYY
OUTPUT
01:35:15
03:20:40
08:30:05
02:10:20
01:00:00