One-pass Algorithm for ⋈         (very similar to ∪S)