Write a function that accepts a string of words with a similar prefix, separated by spaces, and returns the longest substring that prefixes all words.
• The string “swift switch swill swim” should return “swi”.
• The string “flip flap flop” should return “fl”.