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.*

Rajon Bardhan

Language |
Time Limit (seconds) |

C | 3.00 |

C++ | 3.00 |

C++14 | 3.00 |

C# | 5.00 |

Go | 5.00 |

Java | 5.00 |

JavaScript | 5.00 |

Objective-C | 5.00 |

Perl | 5.00 |

PHP | 5.00 |

Python | 5.00 |

Python3 | 5.00 |

Ruby | 5.00 |

VB.Net | 5.00 |

Solve/Submission

# | User | Language | Timing |
---|---|---|---|

01 | Robbinb1993 | Cpp | 0.01s |

02 | afzalul | Cpp | 0.02s |

03 | emrul | Cpp14 | 0.02s |

04 | mdshs | Cpp14 | 0.02s |

05 | nasif2587 | Cpp14 | 0.02s |

06 | Zeronfinity | Cpp14 | 0.03s |

07 | tariqiitju | Cpp14 | 0.03s |

08 | 7Mahfuz | Cpp14 | 0.03s |

09 | souravahmed | C | 0.03s |

10 | feodorv | C | 0.04s |

11 | Morass | Cpp14 | 0.05s |

12 | masba | Python | 0.05s |

13 | saeefad | CSharp | 0.08s |

14 | devcoder | CSharp | 0.09s |

15 | codehead | Cpp14 | 0.09s |

16 | dmehrab06 | Cpp14 | 0.10s |

17 | seyedssz | Cpp14 | 0.10s |

18 | anikatahsin | Cpp14 | 0.14s |

19 | saiful130104 | Cpp14 | 0.14s |

20 | SakibAlamin | Cpp14 | 0.15s |

21 | RandyWaterhouse | Cpp | 0.18s |

22 | joymollick | Cpp14 | 0.18s |

23 | abdulmukit | Cpp | 0.18s |

24 | MAHRahat | Cpp14 | 0.18s |

25 | haasib | Cpp14 | 0.20s |

26 | rayhan50001 | Cpp14 | 0.20s |

27 | sadia2427 | Cpp14 | 0.20s |

28 | smriad | Cpp14 | 0.20s |

29 | rithu | Cpp14 | 0.20s |

30 | mahbub07 | Cpp14 | 0.20s |

31 | ash12 | Cpp14 | 0.21s |

32 | smjlord068 | Cpp14 | 0.24s |

33 | ssavi | Cpp14 | 0.25s |

34 | math10 | Cpp14 | 0.48s |

35 | Indro_BU | Cpp14 | 0.52s |

36 | ahqmrf | Cpp14 | 0.55s |

37 | duronto20 | Cpp14 | 0.55s |

38 | murad_al_wajed | Cpp14 | 0.56s |

39 | SIR_MBSTU | Cpp14 | 0.60s |

40 | Mahmudul_Tushar | Cpp14 | 0.61s |

41 | nuhu_iu | Cpp14 | 0.61s |

42 | alhelal_cse | Cpp14 | 0.66s |

43 | aniscseiu | Cpp14 | 0.79s |

44 | PKP_007 | Cpp14 | 1.29s |

Copyright © 2015-2016 Dev Skill.

Feedback
#### Your feedback is our precious!

## Thank you for providing feedback! Our developers will be happy :)

## Sorry there was a problem when submitting the feedback. Please try again. :(