Check String Rotation

Given two strings *s1* and *s2*, determine if *s2* is a rotation of *s1*. (Hint: check if *s2* is a substring of *s1+s1*.)

Input Format

Two lines: s1, then s2.

Output Format

"true" or "false".

Constraints

  • len <= 10^5.

Examples

Example 1:

Input:

s = "waterbottle"
goal = "erbottlewat"

Output:

true

Explanation:

*s2* is a rotation of *s1*.

Loading...
Check String Rotation - Strings DSA Problem