fork download
  1. import re
  2.  
  3. strings = [
  4. "General Manager or VP Torrance, CARequired education",
  5. "WordWordWord",
  6. "DaveIsAFKRightNow!Cool"
  7. ]
  8. pattern = re.compile(r'((?<=[^\W[A-Z])[A-Z]|(?<=\S)[A-Z](?=[a-z]))')
  9.  
  10. for str in strings:
  11. print(pattern.sub(r' \1', str))
  12.  
Success #stdin #stdout 0.02s 27744KB
stdin
Standard input is empty
stdout
General Manager or VP Torrance, CA Required education
Word Word Word
Dave Is AFK Right Now! Cool