Answer:
public class Main{
public static void main(String[] args) {
System.out.println(replaceSubstring("the dog jumped over the fence", "the", "that"));
}
public static String replaceSubstring(String s1, String s2, String s3){
return s1.replace(s2, s3);
}
}
Step-by-step explanation:
*The code is in Java.
Create function called replaceSubstring that takes three parameters s1, s2, and s3
Use the replace function to replace the s2 with s3 in s1, then return the new string
In the main:
Call the replaceSubstring function with the given strings and print the result