/**
 * Join a list of words into a string and apply conditional capitalization.
 *
 * @param words A list of words to be joined.
 * @param capitalize If true, capitalize the first letter of the joined string.
 * @return The joined string with optional capitalization.
 *
 * Example:
 * joinWords(listOf("hello", "world"), true) => "HelloWorld"
 * joinWords(listOf("hello", "world"), false) => "hello world"
 */
fun joinWords(words: List<String>, capitalize: Boolean): String {

    val joinedString = words.joinToString("")

    return if (capitalize) {
        joinedString.capitalize()
    } else {
        words.joinToString(" ")
    }
}
/**
 * Join a list of words into a string and apply conditional capitalization.
 *
 * @param words A list of words to be joined.
 * @param capitalize If true, capitalize the first letter of the joined string.
 * @return The joined string with optional capitalization.
 *
 * Example:
 * joinWords(listOf("hello", "world"), true) => "HelloWorld"
 * joinWords(listOf("hello", "world"), false) => "hello world"
 */
fun joinWords(words: List<String>, capitalize: Boolean): String {
/**
 * Join a list of words into a string and apply conditional capitalization.
 *
 * @param words A list of words to be joined.
 * @param capitalize If true, capitalize the first letter of the joined string.
 * @return The joined string with optional capitalization.
 *
 * Example:
 * joinWords(listOf("hello", "world"), true) => "HelloWorld"
 * joinWords(listOf("hello", "world"), false) => "hello world"
 */
fun joinWords(words: List<String>, capitalize: Boolean): String {

    val joinedString = words.joinToString("")

    return if (capitalize) {
        joinedString.capitalize()
    } else {
        words.joinToString(" ")
    }
}