Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OCA Oracle Database SQL Exam Guide Exam 1Z0-071

Authors: Steve O'Hearn

1st Edition

1259585492, 978-1259585494

More Books

Students also viewed these Databases questions

Question

What is the message frequency?

Answered: 1 week ago

Question

What is the schedule for this project?

Answered: 1 week ago

Question

Who is responsible for this project?

Answered: 1 week ago