I have to solve some Python regex tasks in one line of code. An example of such a task would be this one: print (one of) the longest word in a text. Here is how I did it:
import re
print(sorted([(word, len(word)) for word in list(filter(None, re.split("[\s.?!,:;]", input())))],
key=lambda x: x[1], reverse=True)[0][0])
Now comes my question: can I somehow put the import part in the print so that everything is in one line? I mean, I don't know if I am allowed to have the import part on a separate line or if I can somehow put it inside my print, this is why I am asking you if this can be made "more one line".
EDIT: I will provide a sample input and output as requested:
INPUT: John is tall.
OUTPUT: John (it would also be all right if it printed "tall", I just want one of the longest words)