All Substrings Help

Help required in all substrings
Can someone please help me in figuring out why this code wont accept ?

https://www.codechef.com/viewsolution/26831137

Sorry in advance if it comes out to be a really silly mistake but your answer will definitely help me a lot

Your Program fails for this test

1
cat
catc

Your Output

ccat

Expected Output

catc
1 Like

Oh right thanks !!!
So I think a check on the second character should work.

1 Like

If u check second character…Think about this

1
ccat
ccatc

So you can simple generate both possibity and choose the minimum

1 Like

Yeah didnt think about that either. Thanks a lot!! I’ll generate both and compare. Must say good cases on this one

1 Like

Yup ! I wrote a whole explanation here :slightly_smiling_face:

1 Like

Yup I read it aweasome explanation just missed that one case during the contest :smile:

@s5960r
can u tell me in which test case my program is failing.
https://www.codechef.com/viewsolution/26854922

@aryankuma0r Your Program fails for this test

1
tvr
tvrt

Your Output

tvrt

Expected Output

ttvr