Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from functools import reduce
- import re
- initial_string = input()
- separators = (',', ';', ':', '.', '!', '(', ')', '"', '\'', '\\', '/', '[', ']')
- initial_string = reduce(lambda s, sep: s.replace(sep, ' '), separators, initial_string)
- words_list = initial_string.split()
- def run(word):
- chars = re.compile('[@_!#$%^&*()<>?/|}{~:]')
- if chars.search(word) == None:
- return False
- else:
- return True
- lower_list = []
- upper_list = []
- mixed_list = []
- for word in words_list:
- if word.islower():
- lower_list.append(word)
- elif word.isupper() and not run(word):
- upper_list.append(word)
- else:
- mixed_list.append(word)
- print("Lower-case: " + ", ".join(lower_list))
- print("Mixed-case: " + ", ".join(mixed_list))
- print("Upper-case: " + ", ".join(upper_list))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement