You are given a string \(S\) in the camel case format. Your task is to convert this string into the snake case format.
Examples of the camel case strings are as follows:
- ComputerHope
- FedEx
- WordPerfect
Note: In the camel case string, the first character may or may not be capitalized.
Examples of the snake case strings are as follows:
- computer_hope
- fed_ex
- word_perfect
Input format
- First line: \(T\) denotes the number of test cases
- Next \(T\) lines: String \(S\)
Output format
For each test case, print the snake case format of the given camel case in the string \(S\) in a new line.
Constraints
\( 1 \le T \le 100 \)
\( 1 \le |S| \le 100 \), where \(|S|\) indicates the length of string \(S\)
String \(S\) is made of lower and upper case English alphabets
First 3 test cases are from the statement itself.
In the fourth test case i.e. random
, there's no uppercase letter in the string, so no need to add underscore anywhere. Hence the output is also random
.
Fifth case is similar to second test valuecase.
In sixth test case, there are continuous uppercase characters. We add underscore before each of them. This is not really the snake case conversion or so to speak but for now we are OK with that.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor