Question: Do not use arrays on a problem involving Strings, and do not use Strings in a problem involving arrays. you must not use either break

 Do not use arrays on a problem involving Strings, and do

Do not use arrays on a problem involving Strings, and do not use Strings in a problem involving arrays.

you must not use either break or continue in your code.

You are allowed to use the following methods from the Java API:

  • class String
    • length
    • charAt
  • class StringBuilder
    • length
    • charAt
    • append
    • toString
  • class Character
    • any method

2. subtract takes two Strings and returns a String: The output string should be the same as the first input string except that you should remove the characters of the second string as follows: remove the first occurrence of the first character, the first occurrence of the second character that appears after the removed character, the first occurrence of the third character that appears after the first two removed characters, etc. If there is no such character to remove, then nothing further is removed. HW2.subtract("gfedcbabcdefg", "acfa") "gfedcbbdeg

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!