Check if two strings havecommon substrings