/**
 * This function takes two strings as input and finds all the common substrings between them.
 *
 * @param string1 The first string.
 * @param string2 The second string.
 * @return A list of common substrings found between the two strings.
 */
fun findCommonSubstrings(string1: String, string2: String): List<String> {

    val commonSubstrings = mutableListOf<String>()
    var i = 0
    while (i < string1.length) {
        var j = 0
        while (j < string2.length) {
            var k = i
            var l = j
            while (k < string1.length && l < string2.length && string1[k] == string2[l]) {
                k++
                l++
                if (string1.substring(i, k) !in commonSubstrings) {
                    commonSubstrings.add(string1.substring(i, k))
                }
            }
            j++
        }
        i++
    }
    return commonSubstrings
}
/**
 * This function takes two strings as input and finds all the common substrings between them.
 *
 * @param string1 The first string.
 * @param string2 The second string.
 * @return A list of common substrings found between the two strings.
 */
fun findCommonSubstrings(string1: String, string2: String): List<String> {
/**
 * This function takes two strings as input and finds all the common substrings between them.
 *
 * @param string1 The first string.
 * @param string2 The second string.
 * @return A list of common substrings found between the two strings.
 */
fun findCommonSubstrings(string1: String, string2: String): List<String> {

    val commonSubstrings = mutableListOf<String>()
    var i = 0
    while (i < string1.length) {
        var j = 0
        while (j < string2.length) {
            var k = i
            var l = j
            while (k < string1.length && l < string2.length && string1[k] == string2[l]) {
                k++
                l++
                if (string1.substring(i, k) !in commonSubstrings) {
                    commonSubstrings.add(string1.substring(i, k))
                }
            }
            j++
        }
        i++
    }
    return commonSubstrings
}