/**
 * Given two strings 'text1' and 'text2', find the common words that appear in both texts.
 *
 * @param text1 The first text string
 * @param text2 The second text string
 * @return A set of common words that appear in both 'text1' and 'text2'
 */
fun findCommonWords(text1: String, text2: String): Set<String> {

    // Split both texts into words
    val words1 = text1.split(" ")
    val words2 = text2.split(" ")
    
    // Initialize an empty set to store common words
    val commonWords = mutableSetOf<String>()
    
    // Iterate through each word in the first text
    for (word1 in words1) {
        // Iterate through each word in the second text
        for (word2 in words2) {
            // Check if the lowercase versions of both words are equal
            if (word1.toLowerCase() == word2.toLowerCase()) {
                // Add the common word to the set
                commonWords.add(word1)
            }
        }
    }
    
    return commonWords
}
/**
 * Given two strings 'text1' and 'text2', find the common words that appear in both texts.
 *
 * @param text1 The first text string
 * @param text2 The second text string
 * @return A set of common words that appear in both 'text1' and 'text2'
 */
fun findCommonWords(text1: String, text2: String): Set<String> {
/**
 * Given two strings 'text1' and 'text2', find the common words that appear in both texts.
 *
 * @param text1 The first text string
 * @param text2 The second text string
 * @return A set of common words that appear in both 'text1' and 'text2'
 */
fun findCommonWords(text1: String, text2: String): Set<String> {

    // Split both texts into words
    val words1 = text1.split(" ")
    val words2 = text2.split(" ")
    
    // Initialize an empty set to store common words
    val commonWords = mutableSetOf<String>()
    
    // Iterate through each word in the first text
    for (word1 in words1) {
        // Iterate through each word in the second text
        for (word2 in words2) {
            // Check if the lowercase versions of both words are equal
            if (word1.toLowerCase() == word2.toLowerCase()) {
                // Add the common word to the set
                commonWords.add(word1)
            }
        }
    }
    
    return commonWords
}