4.1 Problem

In programming there are a few different type of naming conventions, the two most popular of them are: smallCamelCase and snake_case.

At times it is useful to quickly convert from one of them to the other (hence such a functionality is sometimes found in IDEs).

Here is a task for you. Write two functions with the following signatures:

changeToCamelCase(snakeCasedWord::Str)::Str

and

changeToSnakeCase(camelCasedWord::Str)::Str

The functions should perform the conversion as specified in this template:

"hello_world" <=> "helloWorld"
"nice_to_meet_you" <=> "niceToMeetYou"
"translate_to_english" <=> "translateToEnglish"

You may assume that the input is well formatted and contains only the underscores (“_“) and the characters from the Latin alphabet.



CC BY-NC-SA 4.0 Bartlomiej Lukaszuk