This method returns the longest common prefix between two possibly empty sequences of characters. Ensure first that the prefix is shorter than two inputs, then ensure that it is equal to the first few chars of the inputs. Then ensure that it is the longest prefix, which means that either prefix is equal to either of the inputs, or the next character in inputs does not equal.