WA on ALLSUB

Can anyone help me on the problem All Substrings.
Problem link https://www.codechef.com/problems/ALLSUB
It is giving WA on my code.
My code https://www.codechef.com/viewsolution/26878059

1
ba
aabb

Your output: abba whie correct answer is abab

1 Like

No correct answer it shall be lexicographically then it I’ll be aabb.

Why you have to cout>> for the lexicographically order in two while isn’t that a repetion for same sort.

The correct answer should be lexicographic but should also include the shorter string (ba)
so it should be (a"ba"b)

1 Like

It should also contain ba

But why it cant be like abba, it is also containing the ba itself.

Because you dont know what dictionary order means

Because it’s not lexicographically first.

2 Likes