
Let 'S' = "adddef".
Alex could have been trying to type:
- "adef" (second and third 'd' are extra)
- "addef" (second 'd' is extra)
- "addef" (third 'd' is extra)
- "adddef" (no extra characters)
So we have 3 distinct possibilities: "adef", "addef", and "adddef".
Therefore, the answer is 3.
The first line contains a string 'S'.
Return the number of possible original strings modulo 1e9 + 7.
You don't need to print anything. Just implement the given function.
1 <= |S| <= 10^5
'S' contains only lowercase English letters
Time Limit: 1 sec
Approach:
Algorithm:
Number of Ways to Build Empire
Number of Ways to Build Empire
Number of Ways to Build Empire
Number of Ways to Build Empire
Number of Ways to Build Empire
Number of Ways to Build Empire
Ninjas’ Vacation
Ninjas’ Vacation
Ninjas’ Vacation
The kth Permutation
Ninja And The Clan
Diverse Committee Selection