Submit | All submissions | Best solutions | Back to list |
CSTRING - Cyclic String Checker |
Given two ascii-strings s and s'. You should determine if s is a cyclic shift of s'.
Input
The first line contains the number of testcases t. Each of the following t lines contains two strings s and s' which are separated by one blank. The length of s and s' is smaller then 1,000,000.
Output
If the strings s is a cyclic shift of s' output YES otherwise NO.
Example
Input: 2 frei reif hannenhalli illahannah Output: YES NO
Added by: | Simon |
Date: | 2006-10-19 |
Time limit: | 1.541s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | C CSHARP C++ 4.3.2 CPP C99 CLOJURE LISP sbcl LISP clisp D FSHARP FORTRAN GO HASK JAVA LUA OCAML PERL PHP PRLG-swi PYTHON PYTHON3 PY_NBC RUBY SCALA |
Resource: | Ulm Sequence Analysis Course WS 2006 |