Function to check if a string is a rotation of another using a method that checks if one word is a substring of another