Skip to main content
1 of 2
emanresu A
  • 44.2k
  • 5
  • 100
  • 240

Vyxal, 13 bytes

K'2lv∑⁰vca¬;t

Try it Online!

A bit messy.

K             # Substrings
 '         ;  # Filtered by...
         a¬   # None of...
  2lv∑        # Substrings of length 2
       vc     # Are contained in...
      ⁰       # The second input
            t # Get the last (and longest) element
              # This works because K returns the elements in order of shortest to longest
              # And filtering out elements can't unsort it
emanresu A
  • 44.2k
  • 5
  • 100
  • 240