#ACSL2122S1. ACSL2122S1

ACSL2122S1

PROBLEM: ACSL's version of Philippe Chretien's“Fibonacci Clock’displays time by changing the colors displayed in 5 squares, whose side lengths correspond to the first 5 Fibonacci numbers (1, 1, 2, 3, and 5). Given the colors ofthe squares on the clock face, you must output the time that is represented in hh:mm:ss format. The colors will be given to you as a single string of 5 uppercase characters representing the lower 1x1 square.the upper 1x1 square, the 2x2 square, the 3x3 square,and the 5x5 square in that order. (See KICKSTARTER https://basbrun.com/2015/05/04/fbonacci-clock/.

image

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 theVenn Diagram shown) are used to represent 2 different values.yellow represents both hours and minutes; magenta representsboth hours and seconds; and cyan represents both minutes and seconds. White squares are ignored.

image

For both minutes and seconds, the sum of the values of the lengths is multiplied by 5 so that the number of minutes and seconds are in intervals of 5 between 0 and 60 inclusive.However, if the number of minutes or seconds is 60 or moreand/or if the number of hours is 12 or more, change it to a valid time from 00:00:00 to 11:56:55. For example, 09:60:00 would become 10:00:00 and 12:00:60 would be 00:01:00 In this modified version of the clock, the time displayed on the clock in the picture above is 01:15:35. The hours are represented by the red 1x1 square. The minutes are represented by the green 3x3 square (35=15), and the seconds are represented by the blue 2x2 and the blue 5x5 squares (2+5=7 and 75=35).

For example, the 2 illustrations below represent the first two sample inputs. The string“RWGBG”’represents 1 hour, (2+5) * 5 = 35 minutes, and 3 *5= 15 seconds. The string“RCMGB'represents 3 hours (1+2),20 minutes ((1+3)*5), and 40 seconds ((5+1+2)*5) or03:20:40.

image

INPUT: There are 5 sets of data. Each set has a single 5-character string of7 possible uppercasecharacters, such as "RWGBG” The possible letters are R, G, B, C, M, Y, and W. The order isthe lower 1xl, the upper Ixl, the 2x2, the 3x3, and the 5x5 square. We guarantee that the inputwill represent a valid time from 00:00:00 to 11:56:55.

OUTPUT: For each line of data, print the time in hours, minutes, and seconds formatted ashh:mm :ss .

SAMPLE INPUT:

RWGBG
RCMGB
BYYGR
MRGBW
YYYYY

SAMPLE OUTPUT:

01:35:15
03:20:40
08:30:05
02:10:20
01:00:00