#C13079. Distinct Permutations of a String
Distinct Permutations of a String
Distinct Permutations of a String
You are given a string s
consisting of at most 20 characters (letters, digits, or symbols). Your task is to compute the number of distinct permutations of the characters in the string.
For a string of length n, the total number of arrangements is given by:
$$\frac{n!}{\prod_{c} (f(c)!)}$$
where \(f(c)\) denotes the frequency of character \(c\) in the string.
For example, for the string "aab", there are 3 distinct permutations.
inputFormat
The input consists of a single line containing the string s
.
outputFormat
Output a single integer representing the number of distinct permutations of the given string.
## sampleabc
6