/**
 * In this exercise, you need to combine two strings and create a list of pairs with the combined elements.
 * The first string 'names' contains a list of names separated by a space.
 * The second string 'ages' contains a list of ages separated by a space.
 *
 * Your task is to create a list where each element is a pair containing a name and its respective age.
 * The names and ages should be extracted from the given strings.
 *
 * Example:
 * combineStrings("John Alice Bob", "25 30 27") => [("John", 25), ("Alice", 30), ("Bob", 27)]
 */
fun combineStrings(names: String, ages: String): List<Pair<String, Int>> {

    // Split the names and ages using the space as a separator
    val nameList = names.split(" ")
    val ageList = ages.split(" ")

    // Combine the name and age into a list of pairs
    // Using zip() to iterate over both lists simultaneously
    val combinedList = nameList.zip(ageList) { name, age -> Pair(name, age.toInt()) }

    return combinedList
}
/**
 * In this exercise, you need to combine two strings and create a list of pairs with the combined elements.
 * The first string 'names' contains a list of names separated by a space.
 * The second string 'ages' contains a list of ages separated by a space.
 *
 * Your task is to create a list where each element is a pair containing a name and its respective age.
 * The names and ages should be extracted from the given strings.
 *
 * Example:
 * combineStrings("John Alice Bob", "25 30 27") => [("John", 25), ("Alice", 30), ("Bob", 27)]
 */
fun combineStrings(names: String, ages: String): List<Pair<String, Int>> {
/**
 * In this exercise, you need to combine two strings and create a list of pairs with the combined elements.
 * The first string 'names' contains a list of names separated by a space.
 * The second string 'ages' contains a list of ages separated by a space.
 *
 * Your task is to create a list where each element is a pair containing a name and its respective age.
 * The names and ages should be extracted from the given strings.
 *
 * Example:
 * combineStrings("John Alice Bob", "25 30 27") => [("John", 25), ("Alice", 30), ("Bob", 27)]
 */
fun combineStrings(names: String, ages: String): List<Pair<String, Int>> {

    // Split the names and ages using the space as a separator
    val nameList = names.split(" ")
    val ageList = ages.split(" ")

    // Combine the name and age into a list of pairs
    // Using zip() to iterate over both lists simultaneously
    val combinedList = nameList.zip(ageList) { name, age -> Pair(name, age.toInt()) }

    return combinedList
}