String Equivalence: Counting Substrings
CJam, 51 49 47 41 34 bytes
WqN/:Q0=,,{Qf{_,,\f&gt;\)f&lt;$}~=},+W=)

Just to get something started. This can surely be golfed a lot. Looking at a different algorithm too.
Input goes as the two strings without quotes on separate lines.
Example:
aaabbaabb
aabbaaabb

Output:
3

Try it online here