Question: public static void String replacement (String ori, String r, String w) This method should replace all occurrences of the String r with the String w
public static void String replacement (String ori, String r, String w)
This method should replace all occurrences of the String r with the String w if the total length of String r (number of ocurrence X r.length()) is less than 30% of the length of ori String; otherwise, you are going to replace all ocurrences of w with r. Then return a String after applying these rules:
replacement("Skiiing is fun", "fun","cool") should return "Skiing is cool"
replacement("AAABB","A","C") should return "AAABB"
replacement("AAABB", "A","B") should return "AAAAA"
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
