0

Ninja And Editor

Difficulty: EASY
Contributed By
Sounak Majumder
Avg. time to solve
20 min
Success Rate
80%

Problem Statement

Ninja wants to print a book of stories. He created a doc file and sent it to his editor to make some edits. But the file got corrupted due to some reasons and made changes in the original file. Ninja did not have a duplicate file of the same, so he wants to correct the same file. He found that the file has been changed in such a way that all the spaces have been removed from the file and the first letter after each space that used to be has been changed to the equivalent uppercase characters.

Example:
If the corrupted file looks like “CodingNinjasIsACodingPlatform”, then the original file was: “coding ninjas is a coding platform”.

Ninja needs to change the corrupted file to the original file.

Note:
You need to convert all the uppercase characters to lowercase characters, and you need to add a single space between every two words.
Input Format:
The first line contains a single integer ‘T’ representing the number of test cases. 

The first line of each test case will contain a string ‘S’, which denotes the corrupted string that you need to to change.
Output Format:
For each test case, print a single line containing a string denoting the original sentence.

The output for every test case will be printed in a separate line.
Note:
You don't need to print anything, It has already been taken care of. Just implement the given function.
Constraints:
1 <= T <= 50
0 <= size of S <= 10000

where ‘T’ is the number of test cases.
where 'S’ is the corrupted string that you need to to change.

Time limit: 1 sec
Sample Input 1:
2
CodingNinjasIsACodingPlatform
Hello
Sample Output 1:
coding ninjas is a coding platform
hello
Explanation of sample input 1:
In the first test case, 
After replacing the uppercase characters with a space followed by the lowercase conversion of the character we get: 
coding ninjas is a coding platform

In the second test case, 
After replacing the uppercase characters with a space followed by the lowercase conversion of the character we get: 
hello
Sample Input 2:
3
HelloWorld
ILoveCoding
YouCanPracticeCodingOnCodezen
Sample Output 2:
hello world
i love coding
you can practice coding on codezen
Reset Code
Full screen
copy-code
Console