Yes. If you know that the tails are equal, all you need to do is check the first character.
Is the string ""
equal to the string ""
?
Yes
It may seem odd to worry about whether two empty strings are equal, but this needs to be done.
Is the string ""
equal to the string "whatever"
?
No
Is the string "whatever"
equal to the string ""
?
No
Is the string "A.....tail...."
equal to the string "X.....tail...."
?
No
Is the string "A.....tail...."
equal to the string "A.....tail...."
?
Yes — if the tails of the strings are equal.
No — if the tails of the strings are NOT equal.
When using these rules, how do you decide if the tails of two strings are equal?