Question: Write a recursive method that will do the following: It should accept two strings. The first string will be longer than the second string. It
- Write a recursive method that will do the following:
- It should accept two strings. The first string will be longer than the second string. It should return a string that is equal to the first string with all instances of the second string removed.
Example: If the method receives Mississippi and iss then it should return Mippi, which is Mississippi with all occurrences of iss removed.M
If the method receives disfunctional and fun, it will return disctional.
If the second string is not inside the first string, then the method will just return the first string.
- Your recursive method should not have a loop inside it. It should rely on the recursion to do the looping.
- Write a program to test your method (and make sure you test it with more than one set of data. There is no telling how many times the second string may be found in the first string.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
