Given two strings s and goal, return true if and only if s can become goal after some number of shifts on s. A shift on s consists of moving the leftmost character of s to the rightmost position. For example, if s = "abcde", then it will be "bcdea" after one shift.
Example 1
Input: s = abcde, goal = cdeab
Output: true
Explanation: Shifting "abcde" once gives "bcdea", and shifting again gives "cdeab", which is the goal.
Example 2
Input: s = abcde, goal = abced
Output: false
Explanation: No rotation of "abcde" ends with "ed", so it can never become "abced".
Example 3
Input: s = a, goal = a
Output: true
Explanation: The strings are already equal, so zero shifts are needed.
Every rotation of `s` appears as a contiguous substring of `s + s`. So `goal` is a rotation of `s` iff `goal` is a substring of `s + s` (and the lengths match).
Run checks all cases above. Submit evaluates all test cases.