R Word Count - matching all combination of one string in another string : <p>I am trying to count all combinations of matching/fuzzy matching first string column to second string column in a data frame</p>

<p>Eg:<br>
string1 = "USA Canada UK Australia Japan India"
string2 = "USA Canada India UK Australia China Brazil France"</p>

<p>Expected results   </p>

<ul>
<li><p>Single word match count = 5 (USA Canada UK Australia India) matched  </p></li>
<li><p>Two word match count = 2 (USA Canada, UK Australia) consecutive words matched  </p></li>
<li><p>Three word match count = 0  </p></li>
<li><p>Four word match count = 0  </p></li>
<li><p>Five word match count = 0  </p></li>
<li><p>Six word match count = 0  </p></li>
<li><p>In total = 5 + 2 = 7</p></li>
</ul>

<p>Thank you for your time and great someone can help to write this function or point me to use any existing package</p>
