DCP-63: Cyclic String Back to All Problems

Easy Beginners Problems > Ad-hoc


Give two string T and S. Take a decision whether T is a cyclic string of S or not . For example abc and bca are two cyclic strings of one another. If we rotate abc for one time we get cab . Then again rotate cab and we get bca. That’s why abc and bca are two cyclic string of each other. But abc and bac are not cyclic string of each other. [Rotate means move the last character to first position of a string] Input: ------ At first gives you an integer **T (T<=10)**, is the number of test cases. Each case gives two strings T and **S ( 1<=T,S<=1000000 )** in two separated lines. Output: ------- Output **“YES”** if T is a cyclic string of S, otherwise output **“NO”**. Sample Input ------------ 2 abc bca abc bcd Sample Output ------------- YES NO *Look, For Test Case – 1 , if we rotate abc we will get abc -> cab -> bca . For Test Case – 2 , character d is not present in abc. So abc and bcd are not cyclic string of each other.*


Problem Setter:

Rajon Bardhan

Please login to submit solution to this problem.

Problem Limits

Language Time Limit (seconds)
C/C++ 3.00
Java 5.00
C# 5.00
PHP 5.00

Problem Stats

49/212

Solve/Submission

Ranking

# User Language Timing
01 nasif2587 Cpp 0.02s
02 mdshs Cpp 0.02s
03 emrul Cpp 0.02s
04 7Mahfuz Cpp 0.03s
05 Zeronfinity Cpp 0.03s
06 tariqiitju Cpp 0.03s
07 codehead Cpp 0.09s
08 dmehrab06 Cpp 0.10s
09 seyedssz Cpp 0.10s
10 saiful130104 Cpp 0.14s
11 anikatahsin Cpp 0.14s
12 Dragon_162 Cpp 0.15s
13 mahrahat Cpp 0.18s
14 haasib Cpp 0.20s
15 mahbub07 Cpp 0.20s
16 rayhan50001 Cpp 0.20s
17 sadia2427 Cpp 0.20s
18 smriad Cpp 0.20s
19 ash12 Cpp 0.21s
20 smjlord068 Cpp 0.24s
21 ssavi Cpp 0.25s
22 math10 Cpp 0.48s
23 Indro_BU Cpp 0.52s
24 duronto20 Cpp 0.55s
25 ahqmrf Cpp 0.55s
26 murad_al_wajed Cpp 0.56s
27 SIR_MBSTU Cpp 0.60s
28 nuhu_iu Cpp 0.61s
29 Mahmudul_Tushar Cpp 0.61s
30 alhelal_cse Cpp 0.66s
31 aniscseiu Cpp 0.79s
32 PKP_007 Cpp 1.29s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support