#P7566. 饱食
饱食
Problem Description
There are rabbits in the bookworm’s backpack. The -th rabbit is labeled by the bookworm with a string consisting of uppercase letters.
The bookworm knows +C+, and he used +C+ to write a random function that randomly picked three rabbits.
However, the bookworm has temporarily developed anorexia nervosa. He can eat these three rabbits if and only if:
- The first letter of each label is one of
M,C,O, orI. - The first letters of the labels must be all different.
The bookworm wants to know how many ways there are to choose three rabbits so that he can eat the chosen rabbits.
Input Format
The first line contains an integer , representing the number of rabbits.
The next lines each contain a string , representing one rabbit.
Output Format
Output one integer on a single line, representing the answer.
5
MINE
CRAFT
OLYMPIAD
IN
INFORMATICS
7
Hint
Explanation for Sample 1
There are ways to choose:
MINE,CRAFT,OLYMPIAD.MINE,CRAFT,IN.MINE,CRAFT,INFORMATICS.MINE,OLYMPIAD,IN.MINE,OLYMPIAD,INFORMATICS.CRAFT,OLYMPIAD,IN.CRAFT,OLYMPIAD,INFORMATICS.
Constraints
This problem uses bundled tests.
- Subtask 1 (10 pts): The first letter of every is
M. - Subtask 2 (30 pts): .
- Subtask 3 (60 pts): No special constraints.
For of the testdata, , , and consists of uppercase letters.
The testdata does not guarantee that all are distinct.
Translated by ChatGPT 5