#K42652. Rotated String Verification

    ID: 27135 Type: Default 1000ms 256MiB

Rotated String Verification

Rotated String Verification

You are given two strings S and P. Your task is to determine whether S is a rotated version of P. A string S is said to be a rotated version of P if you can obtain S by performing a rotation on P by any number of positions.

For example, consider the string P = "amazon":

  • If you rotate P by 2 positions, you get "azonam", which means S = "azonam" is a rotated version of P.
  • On the other hand, S = "hello" is not a rotated version of P if P is different.

You need to write a program that reads two strings from standard input and prints True if S is a rotated version of P; otherwise, print False.

Note: The comparison is case-sensitive and any rotation that brings P to S is considered valid.

inputFormat

The input consists of two lines:

  1. The first line contains the string S.
  2. The second line contains the string P.

outputFormat

Output a single line containing either True or False depending on whether S is a rotated version of P or not.

## sample
amazon
azonam
True