String sort question

https://ide.codingblocks.com/s/73569 not passing sample case

@Simran-Tuteja-2103059593355380 hey simran in the question is saying string should be sort in lexographically ordering and one more condition is that if two strings have a common part, then string with longer length should come first. Eg bat ,batman are 2 strings have common part as bat - then sorted order should have - batman, bat.
so apply sort function with compare function which will help in this case
hint for custom compare function
bool myCompare(string a, string b) {
if (a.find(b)==0 || b.find(a)==0)
return a.length() > b.length();
return a < b;
}

I’ve used char array and not string, what changes should I make to solve this question using char array? @jaiskid

@Simran-Tuteja-2103059593355380 hey simran you can also make array of strings
like string a[1000];

https://ide.codingblocks.com/s/78925 i have made the changes still it is not getting accepted

@Simran-Tuteja-2103059593355380 hey simran
try with this compare function

bool myCompare(string a, string b) {
if (a.find(b)==0 || b.find(a)==0)
return a.length() > b.length();
return a < b;
}