/**
 * This exercise requires the historian to write a function that takes in two texts and finds the common words between them using loop control statements and tuples.
 *
 * @param text1 The first text.
 * @param text2 The second text.
 * @return A list of common words between the two texts.
 *
 * Example:
 * findCommonWords("Hello world", "World is beautiful") returns ['world']
 */
fun findCommonWords(text1: String, text2: String): List<String> {

    val words1 = text1.split(" ")
    val words2 = text2.split(" ")
    val commonWords = mutableListOf<String>()

    for (word1 in words1) {
        for (word2 in words2) {
            if (word1 == word2) {
                commonWords.add(word1)
            }
        }
    }

    return commonWords
}
/**
 * This exercise requires the historian to write a function that takes in two texts and finds the common words between them using loop control statements and tuples.
 *
 * @param text1 The first text.
 * @param text2 The second text.
 * @return A list of common words between the two texts.
 *
 * Example:
 * findCommonWords("Hello world", "World is beautiful") returns ['world']
 */
fun findCommonWords(text1: String, text2: String): List<String> {
/**
 * This exercise requires the historian to write a function that takes in two texts and finds the common words between them using loop control statements and tuples.
 *
 * @param text1 The first text.
 * @param text2 The second text.
 * @return A list of common words between the two texts.
 *
 * Example:
 * findCommonWords("Hello world", "World is beautiful") returns ['world']
 */
fun findCommonWords(text1: String, text2: String): List<String> {

    val words1 = text1.split(" ")
    val words2 = text2.split(" ")
    val commonWords = mutableListOf<String>()

    for (word1 in words1) {
        for (word2 in words2) {
            if (word1 == word2) {
                commonWords.add(word1)
            }
        }
    }

    return commonWords
}