Index based string matches in python
<p>I have two lists</p>

<pre><code>list1 = ['this', 'is', 'the', 'right', 'string']
list2 = ['this', 'is', 'right']
</code></pre>

<p>After comparison I need to find out another list include only</p>

<pre><code>list3 = ['this', 'is']
</code></pre>

<p>I have tried it up using intersection, I know it is not the proper solution in my case.</p>

<pre><code>&gt;&gt;&gt; list(set(list1) &amp; set(list2))
['this', 'is', 'right']
</code></pre>

<p>It is not the index based comparison. </p>

<p>I need to find the index based comparison. I mean, first compare first words in list1 and list2, if it is match, then take next words in each list then compare that words and so on. If it is not match, then return the matched words only.
Anybody can help me??</p>
