X98: without2

Given a string, if the same 2-character substring appears at both its beginning and end, return the contents of the string without the 2-character substring at the beginning. For example, "HelloHe" yields "lloHe". Note that the 2-character substring at the beginning may overlap with the one at the end, so "Hi" yields "". If the two characters at the start and end of the string do not match each other, return the original string unchanged.

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.