Example-
string is "This is the string"
here longest word is "String"
program-
import functools
print("Enter string")
s=input()
l=s.split()
def func(x,y):
if len(x)>len(y):
return x
else:
return y
x=functools.reduce(func,l)
print("longest Word is :",x)
Enter string
This is the string
longest Word is : string
Enter string
one two three four five six
longest Word is : three