How to check if two strings have any common part (sub-string) in c++.
I thought of sorting the strings and then using loops on both the strings to check if they have a common part. But I am not sure. And I also thought that this would not be the optimal strategy for the question
Consider strings - 'batman' and 'catman' They have a common part 'atman'.
P.S. I am not checking for more than one characters. eg - 'apple' and 'batman' have a in common but I am interested in sub-string (min. two common consecutive characters).