Saying that there are String A = "aabbccdd" and String B = "abcd", is there any way to remove the matching characters of String B towards String A for only one time?
Expected output is A = "abcd".
I know it will solve the problem when using for loops, but is there any simpler way to do it? For example, using replaceAll or regular expressions?