Write a function (method) and unit tests for the following task: Given a string, return the longest substring that appears at both the beginning and end of the string without overlapping. For example, sameEnds("abXab") is "ab". sameEnds("abXYab") → "ab" sameEnds("xx") → "x" sameEnds("xxx") → "x"