Given a string which is basically a sentence without spaces between words. However 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.
Note: The first character of the string can be both uppercase/lowercase.
Input: s = "BruceWayneIsBatman" Output: bruce wayne is batman Explanation: The words in the string are "Bruce", "Wayne", "Is", "Batman".
Input: s = "You" Output: you Explanation: The only word in the string is "You".
You don't need to read input or print anything. Your task is to complete the function amendSentence() which takes the string s as input and returns a string with the stated amendments.
Expected Time Complexity: O(N).
Expected Auxiliary Space: O(N) (for output string).
1<=Size of String <=106
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?Yes