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 to find a username. This was still not creative enough for Veshy, so he is currently trying to increase the number of potential candidate usernames by having wildcard characters (*
) 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 space-separated integers, and .
The following line will have a string composed of only lowercase alphabet characters and/or the character *
. 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 different possibilities for the wildcard character. Out of these possibilities, result in unique permutations (e.g. ba
→ ba
and ab
, bc
→ bc
and cb
, etc.), and results in only unique permutation (when the wildcard character is b
, to make bb
). .
Sample Input 2
2 2
**
Sample Output 2
676
Comments