1720 MatRush's Box
Submit solution
Points:
100
Time limit:
1.0s
Memory limit:
32M
Problem types
Allowed languages
C, C++, Java, Python
Description
MatRush have a box, and now he want to color the box by some given colors, he consider two box is same if and only if by some rotation the former one have the same color as the latter one. Now he give you a set of six colors(some colors may be the same with the other). And he ask you: how many different boxes he can get?
Input
It has multiple test cases in this problem, and MatRush will give you six colors, we use the letters of {'M', 'A', 'T', 'R', 'U', 'S', 'H'} instead of the specific colors.
Output
You must print the number of different boxes MatRush can get by use rotations.
Sample
Input
MATRUS
SSRRRR
Output
30
2
Source: LCS
Comments