Sort all the strings lexicographically but if a string is present completely as a prefix in another string, then string with longer length should come first.
e.g. 1 test, testtube are 2 strings and the string test is present as a prefix in testtube
sorted- testtube, test.
e.g. 2 bank, ant, testtube, test
sorted- ant, bank, testtube, test
How can we do this in python ? Tried alot but have'nt got any solution, need help.