Write a function that converts a string from `camelCase` to `snake_case`.
Lower camel case is the practice of writing phrases without spaces or punctuation, it indicates the separation of one word or more with a single capitalized letter between each word except the first one. Snake case is a style of writing in which each space is replaced by an underscore (_) character.
For this exercise you need to know that camelCase has two different writing alternatives that will be accepted:
- lowerCamelCase
- UpperCamelCase
Some rules for writing in camelCase:
- The word does not end on a capitalized letter (CamelCasE).
- No two capitalized letters shall follow directly each other (CamelCAse).
- Numbers or punctuation are not allowed in the word anywhere (camelCase1).
Here are some rules for you to follow:
@ -11,11 +21,6 @@ Here are some rules for you to follow:
- If the string is not `camelCase`, return the string unchanged.
- If the string is `camelCase`, return the `snake_case` version of the string.
Basic `lowerCamelCase` Capitalization Rules:
- The first letter should be lower case.
- No numbers or punctuations are allowed in the word at any place (camelCase1).