Advertisement
Guest User

Untitled

a guest
Sep 16th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. def with_regex(string):
  2.     from re import findall
  3.     return sorted(findall(r"[\w']+", string), key=lambda x: len(x), reverse=True)[0]
  4.  
  5. def with_replace(string):
  6.     string = "".join([" " if let.lower() not in "qwertyuiopasdfghjklzxcvbnm" else let for let in string])
  7.     return sorted(string.split(), key=lambda x: len(x), reverse=True)[0]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement