/**
 * Given a list of names and corresponding lawsuit results, find the names of the individuals who have won their lawsuits.
 *
 * @param names A list of strings representing the names of individuals involved in lawsuits.
 * @param results A list of pairs, where each pair consists of two elements: the name of an individual and the result
 * of their lawsuit (either "won" or "lost").
 * @return A list of names for individuals who have won their lawsuits.
 *
 * Example:
 * findLawsuitResult(listOf("John", "Lisa", "Mark"), listOf(Pair("John", "won"), Pair("Lisa", "lost"), Pair("Mark", "won")))
 * Output: ["John", "Mark"]
 */
fun findLawsuitResult(names: List<String>, results: List<Pair<String, String>>): List<String> {

    val winners = mutableListOf<String>()  // Create a mutable list to store the names of winners
    for ((name, result) in results) {  // Iterate through each pair in the results list
        if (result == "won") {  // Check if the lawsuit result is 'won'
            winners.add(name)  // Add the name to the winners list
        }
    }
    return winners  // Return the list of winners
}
/**
 * Given a list of names and corresponding lawsuit results, find the names of the individuals who have won their lawsuits.
 *
 * @param names A list of strings representing the names of individuals involved in lawsuits.
 * @param results A list of pairs, where each pair consists of two elements: the name of an individual and the result
 * of their lawsuit (either "won" or "lost").
 * @return A list of names for individuals who have won their lawsuits.
 *
 * Example:
 * findLawsuitResult(listOf("John", "Lisa", "Mark"), listOf(Pair("John", "won"), Pair("Lisa", "lost"), Pair("Mark", "won")))
 * Output: ["John", "Mark"]
 */
fun findLawsuitResult(names: List<String>, results: List<Pair<String, String>>): List<String> {
/**
 * Given a list of names and corresponding lawsuit results, find the names of the individuals who have won their lawsuits.
 *
 * @param names A list of strings representing the names of individuals involved in lawsuits.
 * @param results A list of pairs, where each pair consists of two elements: the name of an individual and the result
 * of their lawsuit (either "won" or "lost").
 * @return A list of names for individuals who have won their lawsuits.
 *
 * Example:
 * findLawsuitResult(listOf("John", "Lisa", "Mark"), listOf(Pair("John", "won"), Pair("Lisa", "lost"), Pair("Mark", "won")))
 * Output: ["John", "Mark"]
 */
fun findLawsuitResult(names: List<String>, results: List<Pair<String, String>>): List<String> {

    val winners = mutableListOf<String>()  // Create a mutable list to store the names of winners
    for ((name, result) in results) {  // Iterate through each pair in the results list
        if (result == "won") {  // Check if the lawsuit result is 'won'
            winners.add(name)  // Add the name to the winners list
        }
    }
    return winners  // Return the list of winners
}