Hard String > Minimum Expression

Mina and Raju playing with string. Raju gives Mina a string S of length L. Mina can rotate the string from left to right. String turns like a circular sequence. Mina’s task is to find the lexicographically smallest sequence from a given string. For example if the given string is ‘alabala’ then the lexicographically smallest string is aalabal. alabala -> labalaa -> abalaal -> balaala -> alaalab -> laalaba -> aalabal Input: ------ The first line contains an integer T( 1<= T <= 100 ) which denotes the number of Test cases. T test cases follow . Each test case contains a string S of length L. Output: ------- For each test case, print a line “Case x: y” where x is replaced by the test case number and y is the lexicographical smallest string. Constraints: -------------- 1 <= T <= 100 1 <= L <= 50000 Sample Input ------------ 2 cgagtcagct ctcc Sample Output ------------- Case 1: agctcgagtc Case 2: ccct

Shakil Ahmed

Language |
Time Limit (seconds) |

C | 0.75 |

C++ | 0.75 |

C++14 | 0.75 |

C# | 1.50 |

Go | 1.50 |

Java | 1.50 |

JavaScript | 1.50 |

Objective-C | 1.50 |

Perl | 1.50 |

PHP | 1.50 |

Python | 1.50 |

Python3 | 1.50 |

Ruby | 1.50 |

VB.Net | 1.50 |

Solve/Submission

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

01 | tariqiitju | Cpp14 | 0.01s |

02 | feodorv | C | 0.01s |

03 | Morass | Cpp14 | 0.01s |

04 | twyu0721 | Cpp | 0.01s |

05 | SakibAlamin | Cpp14 | 0.02s |

06 | anowar1112 | Cpp14 | 0.02s |

07 | alhelal_cse | Cpp14 | 0.02s |

08 | akazad_cse13_ruet | Cpp14 | 0.03s |

09 | ssavi | Cpp14 | 0.03s |

10 | abinash | Cpp14 | 0.03s |

11 | howcum | Cpp14 | 0.04s |

12 | mamun4122 | Cpp14 | 0.04s |

13 | CLown1331 | Cpp14 | 0.05s |

14 | dip_BRUR | Cpp14 | 0.05s |

15 | _dipu | Cpp14 | 0.05s |

16 | Baka_Raffi | Cpp | 0.06s |

17 | Robbinb1993 | Cpp | 0.07s |

18 | MazedRupok | Cpp14 | 0.07s |

19 | saurabh3240 | Cpp14 | 0.07s |

20 | ksohan | Cpp14 | 0.07s |

21 | rayhan50001 | Cpp14 | 0.08s |

22 | darkprinx | Cpp14 | 0.09s |

23 | nasif2587 | Cpp14 | 0.09s |

24 | Masum_ice | Cpp14 | 0.09s |

25 | as_couple | Cpp14 | 0.09s |

26 | Knight_King | Cpp14 | 0.10s |

27 | emrul | Cpp14 | 0.10s |

28 | sayedgkm | Cpp14 | 0.12s |

29 | Rajan_sust | Cpp14 | 0.17s |

30 | rafiul41 | Cpp14 | 0.21s |

31 | nihillian | Cpp | 0.22s |

32 | anikatahsin | Cpp14 | 0.29s |

33 | Pure_Protea | Cpp14 | 0.29s |

34 | PKP_007 | Cpp14 | 0.30s |

35 | Taran | Cpp14 | 0.31s |

36 | Zeronfinity | Cpp14 | 0.33s |

37 | sazal_dev | Cpp14 | 0.34s |

38 | seyedssz | Cpp14 | 0.36s |

39 | rafsan_rana | Cpp14 | 0.38s |

40 | xpo6 | Cpp14 | 0.52s |

41 | aseem_cu | Cpp14 | 0.55s |

42 | Gang_Of_Three_01 | Cpp14 | 0.56s |

43 | EWU_FatimaTasnim | Cpp14 | 0.59s |

44 | Jisancse | Cpp14 | 0.64s |

45 | fsshakkhor | Cpp14 | 0.65s |

46 | moshiur_cse15 | Cpp14 | 0.66s |

47 | skmonir | Cpp14 | 0.69s |

48 | sahedsohel | Cpp14 | 0.71s |

49 | chowdhury | Cpp14 | 0.74s |

50 | sangshaptac | Cpp14 | 0.75s |

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. :(