Given an array of characters, which is basically a sentence. However, there is no space between different words and the first letter of every word is in uppercase. You need to print this sentence after following amendments:
(i) Put a single space between these words.
(ii) Convert the uppercase letters to lowercase.
Input : BruceWayneIsBatman Output : bruce wayne is batman Input : GeeksForGeeks Output : geeks for geeks
We have existing solution for this problem, please refer Put spaces between words starting with capital letters link.
- Split each word starting with capital letter using re.findall(expression, str) method.
- Now change capital letter of each word to lowercase and concatenate each word with space.
bruce wayne is batman
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.