/**
 * This exercise requires the completion of a function that takes a sentence and a number as inputs,
 * and returns a list containing only the words from the sentence that have a length divisible by the given number.
 *
 * Example:
 * intersectionSlicingModulus("The quick brown fox jumps over the lazy dog", 3) -> ['The', 'fox', 'the', 'dog']
 */
fun intersectionSlicingModulus(sentence: String, num: Int): List<String> {

    // Splitting the sentence into individual words
    val words = sentence.split(" ")

    // Initializing an empty list to store words with lengths divisible by the given number
    val divisibleWords = mutableListOf<String>()

    // Iterate over each word in the words list
    for (word in words) {
        // Check if the length of the word is divisible by the given number using modulus operator
        if (word.length % num == 0) {
            divisibleWords.add(word)
        }
    }

    return divisibleWords
}
/**
 * This exercise requires the completion of a function that takes a sentence and a number as inputs,
 * and returns a list containing only the words from the sentence that have a length divisible by the given number.
 *
 * Example:
 * intersectionSlicingModulus("The quick brown fox jumps over the lazy dog", 3) -> ['The', 'fox', 'the', 'dog']
 */
fun intersectionSlicingModulus(sentence: String, num: Int): List<String> {
/**
 * This exercise requires the completion of a function that takes a sentence and a number as inputs,
 * and returns a list containing only the words from the sentence that have a length divisible by the given number.
 *
 * Example:
 * intersectionSlicingModulus("The quick brown fox jumps over the lazy dog", 3) -> ['The', 'fox', 'the', 'dog']
 */
fun intersectionSlicingModulus(sentence: String, num: Int): List<String> {

    // Splitting the sentence into individual words
    val words = sentence.split(" ")

    // Initializing an empty list to store words with lengths divisible by the given number
    val divisibleWords = mutableListOf<String>()

    // Iterate over each word in the words list
    for (word in words) {
        // Check if the length of the word is divisible by the given number using modulus operator
        if (word.length % num == 0) {
            divisibleWords.add(word)
        }
    }

    return divisibleWords
}