Թաքցված խնդիր
|Այս խնդիրը թաքցված է խմբագրական խրհրդի անդամի կողմից քանի որ կամ այն ոչ ճիշտ լեզվով է գրված,|կամ թեստային տվյալներն են սխալ, կամ խնդրի ձևակերպումը պարզ չէ։|

ACM_0162 - GIVEN A STRING

  Peter’s Boss is now very upset. He said that Peter’s vision of the orthogonal sum of two strings is not collinear to the general pary line of RIGS. At least, it is very bad that the orthogonal sum of two strings in Peter’s vision can be different depending on a selected set of strings. But Boss decided to give Peter a last str. . . well, a chance.

   Peter’s colleague Andrew invented another definition of orthogonal sum of two strings of equal length n, which depends only on the alphabet. The basic alphabet to define this operation consists only of zeros and ones. The orthogonal sum of two strings a b is just a string c where ci = ai bi (Si denotes i-th character of string S).  Here stands for exclusive OR operation which returns 0 for equal characters and 1 otherwise.

   Now Peter must study properties of orthogonal closure  of a given string S.  The orthogonal closure of (denoted S) is a set of strings S(k) S(l) for any 0 k, l n 1, where n is the length of S, and S(k) denotes an operation of k-th circular shift of S — moving k last characters from the end of the string to its beginning.  For example, the second circular shift of abcde is deabc.

   Given a string T , Peter’s task is to check whether it belongs to S.  Could you solve this task for him?

Input

   The first line of the input file contains a given string T .  The second line contains S.  Both strings are of equal length in range from 1 to 5 000 characters. All characters in these strings are zeros or ones.

Output

   If a given string belongs to S, output “Yes”. Otherwise output “No”.

Examples

stdin

stdout

1

11111

10101

No

2

11110

10101

Yes


Ավելացրեց.Հրանտ Հովհաննիսյան
Ամսաթիվ.2014-04-09
Ժամանակի սահմանափակումը.1s
Ծրագրի տեքստի սահմանափակումը.50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Լեզուներ.Բոլորը բացի ASM32 ASM64 GAWK CLPS CLOJURE D ERL FSHARP FORTRAN GOSU HASK ICON ICK NEM NIM OBJC-CLANG PICO PIKE PYPY PYPY3 PY_NBC RUST SCM guile CHICKEN SED TCL WHITESPACE
Աղբյուրը.Northern QF 2007.G

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.