Veshy is trying to come up with a username for his new alt-account! Unfortunately, he is currently in a creative lull, so he has turned to permuting strings of lowercase letters of length *
) in his starting string before permuting. Since you are Veshy's absolute best friend, help him find the number of candidate usernames!
Constraints
For all subtasks:
Subtask 1 [10%]
Subtask 2 [10%]
Subtask 3 [20%]
Subtask 4 [60%]
No additional constraints.
Input Specification
The first line will have *
. There will be *
's in the string.
Output Specification
Output the total number of possible permutations of the string.
Sample Input 1
2 1
b*
Sample Output 1
51
Explanation of Sample Output 1
There are ba
→ ba
and ab
, bc
→ bc
and cb
, etc.), and b
, to make bb
).
Sample Input 2
2 2
**
Sample Output 2
676
Comments