Try this idea. Traverse the first string, and after getting the characters, determine whether the second string contains it. If it does, remove all the characters in the two strings.
Actually, the requirements can be explained a little more clearly. If the two strings are "The weather is very good today and my name is Xiao Wang" and "The weather is very good today and my name is Da Wu and he is Xiao Wang's brother", what should be obtained in this case?
I’m here to join in the fun, es6 means no pressure. . .
Pattern matching problem
If it’s like you said:
It can be like this:
To meet greater needs, it may need to be further spread out
Try this idea. Traverse the first string, and after getting the characters, determine whether the second string contains it. If it does, remove all the characters in the two strings.
Actually, the requirements can be explained a little more clearly. If the two strings are "The weather is very good today and my name is Xiao Wang" and "The weather is very good today and my name is Da Wu and he is Xiao Wang's brother", what should be obtained in this case?