Plagiarism detection

You are trying to implement a plagiarism detection system for essays. The first thing to consider is the number of unique words that occur in the first essay that is also present in the second one. You decide to quickly implement that feature and move on to more elaborate ones.
The first line of the input contains the first essay. The second line contains the second one.
The program should print the number of unique words (words are separated by a space in both essays) that are present in both essays.
Input
Output
Hello I am Tyler, I really love programming Hello I am Michael, I really love machine learning
5
Explanation: There are 5 unique words that are present in both sentences: Hello, I, am, really, love.
 

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue