I have sets
{1, 2, 3, 4}
{2, 3, 4, 5}
{3, 4, 5, 6}
{4, 5, 6, 7}
{5, 6, 7, 8}
I need to intersect sets start from first. I mean that I should to intersect
{1, 2, 3, 4}
{2, 3, 4, 5}
{3, 4, 5, 6}
next
{2, 3, 4, 5}
{3, 4, 5, 6}
{4, 5, 6, 7}
and
{3, 4, 5, 6}
{4, 5, 6, 7}
{5, 6, 7, 8}
How can I do it in the loop? I know that I can use set1 & set2 & set3
, but I don't know how can I do it with next set2 & set3 & set4
etc?