0

I have a list of strings in Python:

['movie-about-trees', 'movie-about-birds', 'movie-about-grass']

I'm trying to get the common elements (characters) of these items BUT in an ordered way up to the point where they become different.

So the output should ideally be:

movies-about-

This example should have no match:

['bird-movie', 'movie-about-birds', 'movie-about-grass']

And this:

['movie-on-trees', 'movie-about-birds', 'movie-theaters']

should give:

movie-

unicorn80
  • 1,107
  • 2
  • 9
  • 15

0 Answers0