/**
 * This exercise aims to test your knowledge on using set comprehension and the index() method.
 * You are required to write a function that takes in two text strings as parameters and returns
 * a set containing all the common words between them.
 *
 * @param text1 The first text string.
 * @param text2 The second text string.
 * @return A set containing the common words between text1 and text2.
 *
 * Example:
 * findCommonWords("The quick brown fox", "brown fox jumps over the lazy dog") -> setOf("brown", "fox")
 */
fun findCommonWords(text1: String, text2: String): Set<String> {

    // Split the text into individual words
    val words1 = text1.toLowerCase().split(" ").toSet()
    val words2 = text2.toLowerCase().split(" ").toSet()

    // Find the common words using set comprehension
    val commonWords = words1.filter { it in words2 }.toSet()

    return commonWords
}
/**
 * This exercise aims to test your knowledge on using set comprehension and the index() method.
 * You are required to write a function that takes in two text strings as parameters and returns
 * a set containing all the common words between them.
 *
 * @param text1 The first text string.
 * @param text2 The second text string.
 * @return A set containing the common words between text1 and text2.
 *
 * Example:
 * findCommonWords("The quick brown fox", "brown fox jumps over the lazy dog") -> setOf("brown", "fox")
 */
fun findCommonWords(text1: String, text2: String): Set<String> {
/**
 * This exercise aims to test your knowledge on using set comprehension and the index() method.
 * You are required to write a function that takes in two text strings as parameters and returns
 * a set containing all the common words between them.
 *
 * @param text1 The first text string.
 * @param text2 The second text string.
 * @return A set containing the common words between text1 and text2.
 *
 * Example:
 * findCommonWords("The quick brown fox", "brown fox jumps over the lazy dog") -> setOf("brown", "fox")
 */
fun findCommonWords(text1: String, text2: String): Set<String> {

    // Split the text into individual words
    val words1 = text1.toLowerCase().split(" ").toSet()
    val words2 = text2.toLowerCase().split(" ").toSet()

    // Find the common words using set comprehension
    val commonWords = words1.filter { it in words2 }.toSet()

    return commonWords
}