/**
 * This exercise requires the psychologist to write a function that performs concatenation with the 'not in' operator.
 * The function takes two parameters: words and forbidden. It concatenates all words from the 'words' list and separates them with a space,
 * but only if the word is not present in the 'forbidden' list. Finally, it returns the concatenated string.
 *
 * Example:
 * words = ['apple', 'banana', 'orange']
 * forbidden = ['banana', 'grape']
 * notInConcatenation(words, forbidden)
 */
fun notInConcatenation(words: List<String>, forbidden: List<String>): String {

    // Initialize an empty list to store the forbidden words
    val concatenated = mutableListOf<String>()

    // Iterate through each word in the words list
    for (word in words) {
        // Check if the word is not present in the forbidden list
        if (word !in forbidden) {
            // Append the word to the concatenated list
            concatenated.add(word)
        }
    }

    // Use the joinToString function to concatenate all words in the concatenated list with a space in between
    val result = concatenated.joinToString(" ")

    return result
}
/**
 * This exercise requires the psychologist to write a function that performs concatenation with the 'not in' operator.
 * The function takes two parameters: words and forbidden. It concatenates all words from the 'words' list and separates them with a space,
 * but only if the word is not present in the 'forbidden' list. Finally, it returns the concatenated string.
 *
 * Example:
 * words = ['apple', 'banana', 'orange']
 * forbidden = ['banana', 'grape']
 * notInConcatenation(words, forbidden)
 */
fun notInConcatenation(words: List<String>, forbidden: List<String>): String {
/**
 * This exercise requires the psychologist to write a function that performs concatenation with the 'not in' operator.
 * The function takes two parameters: words and forbidden. It concatenates all words from the 'words' list and separates them with a space,
 * but only if the word is not present in the 'forbidden' list. Finally, it returns the concatenated string.
 *
 * Example:
 * words = ['apple', 'banana', 'orange']
 * forbidden = ['banana', 'grape']
 * notInConcatenation(words, forbidden)
 */
fun notInConcatenation(words: List<String>, forbidden: List<String>): String {

    // Initialize an empty list to store the forbidden words
    val concatenated = mutableListOf<String>()

    // Iterate through each word in the words list
    for (word in words) {
        // Check if the word is not present in the forbidden list
        if (word !in forbidden) {
            // Append the word to the concatenated list
            concatenated.add(word)
        }
    }

    // Use the joinToString function to concatenate all words in the concatenated list with a space in between
    val result = concatenated.joinToString(" ")

    return result
}