Handle Score
@Ibrahim Nash 6420
@blackshadows 6380
@mb1973 5646
@Quandray 5233
@akhayrutdinov 5111
@saiujwal13083 4716
@sanjay05 3762
@kirtidee18 3673
@marius_valentin_dragoi 3522
@sushant_a 3459
@verma_ji 3413
Complete Leaderboard
Amend The Sentence
Easy Accuracy: 65.66% Submissions: 236 Points: 2

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.

Example 1:

s = "BruceWayneIsBatman"
Output: bruce wayne is batman
Explanation: The words in the string are
"Bruce", "Wayne", "Is", "Batman".

​Example 2:

s = "You"
Output: you
Explanation: The only word in the string
is "You".

Your Task: 
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

to report an issue on this page.


We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?


All Submissions

My Submissions:

Login to access your submissions.

Amend The Sentence

Output Window