Question: pairRemoval ( String , String, String ) This is a public static function that takes three Strings as arguments and returns a String. You will

pairRemoval(String, String, String)
This is a public static function that takes three Strings as arguments and returns a String.
You will be given three strings, the first string is a sentence known as text that contains at least one occurrence of left pattern and right pattern. The second and third arguments of the function are the left and right patterns respectively. Left pattern and right pattern are single characters strings that you are attempting to remove from the string. Your goal is to remove only the patterns when the left pattern has an equal number of corresponding right patterns. The patterns are removed in pairs only when there is a balanced number of left and right patterns. The patterns may be nested within the text and there is no guarantee that a left pattern will occur before the right pattern in java.
Arguments:
String text - The string with the substring to be removed
String leftPattern- A pattern that the substring must start with
String rightPattern-A pattern that the substring must end with
returns String- The given text with the paired patterns removed
Example:
text={{Muscat}}{}mecum tollgate}poultry quarrymen pantheon asteria
leftPattern={
rightPattern=}
return=Muscat mecum tollgate} poultry quarrymen asteria
 pairRemoval(String, String, String) This is a public static function that takes

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!