Calculates all common substrings of two given stings