#K48187. Distinct Permutations Count

    ID: 28365 Type: Default 1000ms 256MiB

Distinct Permutations Count

Distinct Permutations Count

Given a string S, compute the number of distinct permutations of its characters. For example, the string "aabb" has 6 distinct arrangements.

The number of distinct permutations is given by the formula:

$$ \frac{n!}{\prod_{i=1}^{k} f_i!} $$

where n is the length of the string and each fi is the frequency of the i-th distinct character.

Read the string from standard input and output the computed number to standard output.

inputFormat

The input consists of a single line containing the string S. The string only contains alphabetic characters.

outputFormat

Output a single integer representing the number of distinct permutations of the input string.

## sample
abc
6