def f(x):l=len;m=filter;y=sorted([''.join(m(str.isalnum,i))for i in x],key=l);*z,=m(l,[''.join(i for i in y if-~j==l(i))for j inrange(l(y[-1]))]);y==z and+print(*z,sep='\n')or f(z)
for x in(['This is a sample text,','that you will have to use to build stairs.','The wood may be of excellent quality,','or pretty crappy almost falling apart and filled with termites.','Bla bla bla - some more text','Ok, that will do'],['A','small','one','that','contains','equal','length','strings','for','the','special','rule'],['Test,','test.','This','is','a','test.']):
Okthatwilldo
Thisisasampletext
Blablablasomemoretext
Thewoodmaybeofexcellentquality
thatyouwillhavetousetobuildstairs
orprettycrappyalmostfallingapartandfilledwithtermites
A
length
oneforthe
smallequal
stringsspecial
thatrulecontains
a
is
TesttestThistest