String Sort unable to approach

I am unable to know approach can anyone help me in approaching this problem?

You have to sort the strings in lexicographic (dictionary) order,

do this for every string in array{
compare one string with every other string, if both turn out to be same like bat and batman, then print the one with larger length(batman)
}
This way either your largest or your smallest string goes to front or back after every iteration.