Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def with_regex(string):
- from re import findall
- return sorted(findall(r"[\w']+", string), key=lambda x: len(x), reverse=True)[0]
- def with_replace(string):
- string = "".join([" " if let.lower() not in "qwertyuiopasdfghjklzxcvbnm" else let for let in string])
- return sorted(string.split(), key=lambda x: len(x), reverse=True)[0]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement