For example, in for the word MISSISSIPPI there are 11!/(4!)(4!)(2!) possible permutations, since I and S are reapeated 4 times and P is repeated twice.
But this is only the number of permutations using all 11 letters. I'm not sure what the formula is or even how to go about solving 'how many possible substrings of length 5 are there that can be made using the letters in MISSISSIPPI?'
I got stuck trying to brute force it since e.g., if the first 4 letters are all S then there are 3 options for the fifth letter (M, I or P), but if you use less than 4 S's then there are 4 options for the fifth letter (M, I, P or S). This idea lets to too many possible scenarios to check.
I've tried looking it up but the only answers I can find give the number of combinations using ALL the letters in the string, and not a substring.