#K73047. Rotated Substring Search

    ID: 33888 Type: Default 1000ms 256MiB

Rotated Substring Search

Given two strings s and t, determine whether there exists a contiguous substring of s that, after applying a cyclic rotation, equals t. A cyclic rotation of a string w is defined as moving a prefix of w to its end. Formally, for an integer \( k \) such that \( 0 \le k < |w| \), the string rotated by \( k \) is \( w[k:] + w[:k] \). For example, "eabcd" is a cyclic rotation of "abcde".

Your task is to check if there is any contiguous substring of s with length equal to t that can be rotated in some way to become exactly t.

inputFormat

The input consists of two lines:

  • The first line contains the string s.
  • The second line contains the string t.

Both s and t consist of lowercase English letters.

outputFormat

Output a single line: YES if there exists a substring of s that can be cyclically rotated to become t, and NO otherwise.

## sample
abcdefghi
cde
YES