#K67052. Convert Sentence to Snake Case
Convert Sentence to Snake Case
Convert Sentence to Snake Case
Given a sentence, your task is to convert it into snake_case format. In snake_case, all letters are lowercase and spaces are replaced with underscores.
For example:
- If the input is "Hello World", the output should be "hello_world".
- If the input is "Snake case conversion", the output should be "snake_case_conversion".
- If the input is "Multiple spaces here", the output should be "multiple__spaces__here".
- If the input is "NoSpacesHere", the output should be "nospaceshere".
- If the input is "Hello, World!", the output should be "hello,_world!".
Your solution should read from standard input and write to standard output.
inputFormat
The input consists of a single line containing a sentence s (possibly containing spaces, punctuation, or both) that needs to be converted to snake_case. The length of s is at least 1 character.
outputFormat
Output the snake_case version of the given sentence where all letters are converted to lowercase and every space is replaced with an underscore (_
).
Hello World
hello_world