My question is the same as this but with a catch: How many substrings of length m can be formed from a string of length n?
To find the number of possible substrings of length C in a parent string of length P I can use this formula:
$$P - C + 1$$
For example, for a parent string of length $5$ and a substring of length $3$, there are $5 - 3 + 1 = 3$ different positions the substring can take in its parent.
The problem is, if we ask this formula how many substrings of length 3 fit in a parent string of length 1, we get $1 - 3 + 1 = -1$, instead of the expected $0$.
Is there a simple function that will give $0$ when $P < C$ without using an if statement?