Write a method that returns the longest common prefix of two strings. for example, the longest common
Fantastic news! We've Found the answer you've been seeking!
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 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.
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date: