aneliabogeva

Split by Word Casing

Jun 18th, 2019
115
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import re
  2.  
  3. words = [str(item) for item in re.split("[,;:.!()\"\'\\\\/\[\] ]+", input())if item != ""]
  4. lower_case = []
  5. upper_case = []
  6. mixed_case = []
  7.  
  8. for word in words:
  9. if re.compile("^[a-z]+$").match(word):
  10. lower_case.append(word)
  11. elif re.compile("^[A-Z]+$").match(word):
  12. upper_case.append(word)
  13. else:
  14. mixed_case.append(word)
  15.  
  16. print("Lower-case: ", end="")
  17. print(", ".join(lower_case))
  18. print("Mixed-case: ", end="")
  19. print(", ".join(mixed_case))
  20. print("Upper-case: ", end="")
  21. print(", ".join(upper_case))
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×