0 out of 464 challenges solved
Write a Python function `capital_words_spaces` that takes a single string as input and returns a new string where spaces are inserted between words that start with capital letters. The function should preserve the original order of the words. #### Example Usage ```python [main.nopy] print(capital_words_spaces("Python")) # Output: "Python" print(capital_words_spaces("PythonProgrammingExamples")) # Output: "Python Programming Examples" print(capital_words_spaces("GetReadyToBeCodingFreak")) # Output: "Get Ready To Be Coding Freak" ``` #### Constraints - The input string will only contain alphabetic characters. - The input string will not be empty.
import re def capital_words_spaces(input_string): """ Insert spaces between words starting with capital letters in the given string. Args: input_string (str): The input string containing words without spaces. Returns: str: A new string with spaces inserted between capitalized words. """ # Use a regular expression to identify the pattern and insert spaces pass # Replace this with the actual implementation