/**
 * A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward.
 * A Carpenter wants to find all the palindromes that can be created by concatenating two different words from two given strings.
 *
 * @param string1 The first string.
 * @param string2 The second string.
 * @return A list of all the palindromes that can be created.
 */
fun carpentersPalindrome(string1: String, string2: String): List<String> {

    val palindromes = mutableListOf<String>()

    string1.split(" ").forEach { word1 ->
        string2.split(" ").forEach { word2 ->
            val concatenation = word1 + word2
            if (concatenation == concatenation.reversed()) {
                palindromes.add(concatenation)
            }
        }
    }

    return palindromes
}
/**
 * A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward.
 * A Carpenter wants to find all the palindromes that can be created by concatenating two different words from two given strings.
 *
 * @param string1 The first string.
 * @param string2 The second string.
 * @return A list of all the palindromes that can be created.
 */
fun carpentersPalindrome(string1: String, string2: String): List<String> {
/**
 * A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward.
 * A Carpenter wants to find all the palindromes that can be created by concatenating two different words from two given strings.
 *
 * @param string1 The first string.
 * @param string2 The second string.
 * @return A list of all the palindromes that can be created.
 */
fun carpentersPalindrome(string1: String, string2: String): List<String> {

    val palindromes = mutableListOf<String>()

    string1.split(" ").forEach { word1 ->
        string2.split(" ").forEach { word2 ->
            val concatenation = word1 + word2
            if (concatenation == concatenation.reversed()) {
                palindromes.add(concatenation)
            }
        }
    }

    return palindromes
}