/**
 * This function takes in two strings 'text1' and 'text2', and returns a list of common words present in both strings.
 */
fun findCommonWords(text1: String, text2: String): List<String> {

    // Splitting the strings into words
    val words1 = text1.split(" ")
    val words2 = text2.split(" ")

    // Initializing an empty list to store common words
    val commonWords = mutableListOf<String>()

    // Looping through each word in the first string
    for (word1 in words1) {
        // Checking if the word is present in the second string using 'contains' function
        if (word1 in words2) {
            // If the word is found in both strings, add it to the commonWords list
            commonWords.add(word1)
        }
    }

    return commonWords
}
/**
 * This function takes in two strings 'text1' and 'text2', and returns a list of common words present in both strings.
 */
fun findCommonWords(text1: String, text2: String): List<String> {
/**
 * This function takes in two strings 'text1' and 'text2', and returns a list of common words present in both strings.
 */
fun findCommonWords(text1: String, text2: String): List<String> {

    // Splitting the strings into words
    val words1 = text1.split(" ")
    val words2 = text2.split(" ")

    // Initializing an empty list to store common words
    val commonWords = mutableListOf<String>()

    // Looping through each word in the first string
    for (word1 in words1) {
        // Checking if the word is present in the second string using 'contains' function
        if (word1 in words2) {
            // If the word is found in both strings, add it to the commonWords list
            commonWords.add(word1)
        }
    }

    return commonWords
}