#K59777. Rotation String Check

    ID: 30940 Type: Default 1000ms 256MiB

Rotation String Check

Rotation String Check

You are given two strings X and Y. Your task is to determine if Y is a rotation of X.

A string Y is considered a rotation of string X if and only if Y is a substring of the string formed by concatenating X with itself, i.e., $$Y \in (X+X)$$. For example, if X = "waterbottle" and Y = "erbottlewat", then Y is a rotation of X.

Note: The comparison is case-sensitive.

inputFormat

The input consists of two lines. The first line contains the string X and the second line contains the string Y. Both strings are non-empty and consist of alphanumeric characters.

outputFormat

Output a single line containing "YES" if Y is a rotation of X, otherwise output "NO".## sample

erbottlewat
waterbottle
YES