anagolに出題すべきだった問題

haskellで書いていればもっとすっきりしていたはず

#!/usr/bin/env python3
import re
from itertools import takewhile
s = input()
ws = re.split('w(?=[^w]|$)', s)
ws = ws[:-1]
ws = list(filter(lambda w: len(w) and w[0] != 'w', ws))
ws = list(map(lambda w: (w + 'w').partition('w'), ws))
ws = list(sorted(ws, key=lambda p: len(p[2]), reverse=True))
ws = list(takewhile(lambda p: len(p[2]) == len(ws[0][2]), ws))
ws = list(map(lambda p: p[0], ws))
list(map(print, ws))