BubbleDecorations
For next year’s Bubble Cup the organizers thought of the possible decorations that could be arranged. One idea was to create a string of balloons that could go all around the competition arena. The problem is that the director of competition likes only certain sequences of balloon colors to be used for the string. For example, if there are four different colors: A, B, C and D, the director might say that only the sequences ABB, BCA, BCD, CAB, CDD and DDA can be used for decoration. If the length of the string was 5, then the only possible arrangements could be BCABB and BCDDA (strings such as ABBCA could not be used because BBC is not an approved sequence). Since the director likes variety, it is important to know the total number of arrangements possible, given the list of approved sequences.
Input:
4 5 6
ABB BCA BCD CAB CDD DDAOutput:
2 Input:
5 4 5
X Y Z W QOutput:
625 Input:
4 8 3
AA BB CCOutput:
3 Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.