Score : $300$ points
There are $N$ people. The name of the $i$-th person is $S_i$.
We would like to choose three people so that the following conditions are met:
M
, A
, R
, C
or H
.How many such ways are there to choose three people, disregarding order?
Note that the answer may not fit into a $32$-bit integer type.
Input is given from Standard Input in the following format:
$N$ $S_1$ $:$ $S_N$
If there are $x$ ways to choose three people so that the given conditions are met, print $x$.
5 MASHIKE RUMOI OBIRA HABORO HOROKANAI
2
We can choose three people with the following names:
MASHIKE
, RUMOI
, HABORO
MASHIKE
, RUMOI
, HOROKANAI
Thus, we have two ways.
4 ZZ ZZZ Z ZZZZZZZZZZ
0
Note that there may be no ways to choose three people so that the given conditions are met.
5 CHOKUDAI RNG MAKOTO AOKI RINGO
7