Problem statement

https://binarysearch.com/problems/Common-Words/

Solution

We can use functionality of split and sets.

Complexity

It is O(n1 + n2) for time and space.

Code

class Solution:
    def solve(self, s0, s1):
        return len(set(s0.lower().split()) & set(s1.lower().split()))