Question: Write a method that returns the longest common prefix of two strings. for example, the longest common prefix of distance and disinfection is dis. the
- Write a method that returns the longest common prefix of two strings. for example, the longest common prefix of distance and disinfection is dis. the header of the method is:def prefix(s1, s2)if the two strings have no common prefix, the method returns an empty string. write a main method that prompts the user to enter two strings and displays their common prefix.
Step by Step Solution
3.46 Rating (149 Votes )
There are 3 Steps involved in it
Python Code def prefixs1 s2 Function prefix accept two parameters and return a common ... View full answer
Get step-by-step solutions from verified subject matter experts
