/**
 * Given two lists of words, find the common words present in both lists and return a dictionary.
 *
 * @param wordList1 List of words (String) to compare.
 * @param wordList2 List of words (String) to compare.
 * @return A dictionary where the keys represent the common words and the values represent the count of the common word in both lists.
 */
fun findCommonWords(wordList1: List<String>, wordList2: List<String>): Map<String, Int> {

    val commonWords = mutableMapOf<String, Int>()
    for (word in wordList1) {
        if (wordList2.contains(word)) {
            commonWords[word] = commonWords.getOrDefault(word, 0) + 1
        }
    }
    return commonWords
}
/**
 * Given two lists of words, find the common words present in both lists and return a dictionary.
 *
 * @param wordList1 List of words (String) to compare.
 * @param wordList2 List of words (String) to compare.
 * @return A dictionary where the keys represent the common words and the values represent the count of the common word in both lists.
 */
fun findCommonWords(wordList1: List<String>, wordList2: List<String>): Map<String, Int> {
/**
 * Given two lists of words, find the common words present in both lists and return a dictionary.
 *
 * @param wordList1 List of words (String) to compare.
 * @param wordList2 List of words (String) to compare.
 * @return A dictionary where the keys represent the common words and the values represent the count of the common word in both lists.
 */
fun findCommonWords(wordList1: List<String>, wordList2: List<String>): Map<String, Int> {

    val commonWords = mutableMapOf<String, Int>()
    for (word in wordList1) {
        if (wordList2.contains(word)) {
            commonWords[word] = commonWords.getOrDefault(word, 0) + 1
        }
    }
    return commonWords
}