/**
 * Calculate the distance between two planets in a galaxy.
 *
 * @param planet1 Name of the first planet
 * @param planet2 Name of the second planet
 * @return Distance between the two planets
 */
fun calculateDistance(planet1: String, planet2: String): Double {

    val distances = mapOf(
        "Earth-Mars" to 78.3,
        "Earth-Venus" to 41.6,
        "Mars-Venus" to 36.7,
        "Jupiter-Saturn" to 503.2,
        "Saturn-Uranus" to 179.4,
        "Uranus-Neptune" to 101.0,
        "Mercury-Pluto" to 725.9
    )

    var distance: Double? = null

    // Iterate over the distances map
    for ((key, value) in distances) {
        if (planet1 in key && planet2 in key) {
            distance = value
            break
        }
    }

    // Display the result
    if (distance != null) {
        println("The distance between $planet1 and $planet2 is $distance light-years.")
    } else {
        println("Unable to calculate")
    }

    return distance ?: 0.0
}
/**
 * Calculate the distance between two planets in a galaxy.
 *
 * @param planet1 Name of the first planet
 * @param planet2 Name of the second planet
 * @return Distance between the two planets
 */
fun calculateDistance(planet1: String, planet2: String): Double {
/**
 * Calculate the distance between two planets in a galaxy.
 *
 * @param planet1 Name of the first planet
 * @param planet2 Name of the second planet
 * @return Distance between the two planets
 */
fun calculateDistance(planet1: String, planet2: String): Double {

    val distances = mapOf(
        "Earth-Mars" to 78.3,
        "Earth-Venus" to 41.6,
        "Mars-Venus" to 36.7,
        "Jupiter-Saturn" to 503.2,
        "Saturn-Uranus" to 179.4,
        "Uranus-Neptune" to 101.0,
        "Mercury-Pluto" to 725.9
    )

    var distance: Double? = null

    // Iterate over the distances map
    for ((key, value) in distances) {
        if (planet1 in key && planet2 in key) {
            distance = value
            break
        }
    }

    // Display the result
    if (distance != null) {
        println("The distance between $planet1 and $planet2 is $distance light-years.")
    } else {
        println("Unable to calculate")
    }

    return distance ?: 0.0
}