/**
 * This function takes a list of lawyers and a nested list of cases.
 * It returns a new list that contains only the cases that match the lawyer's name.
 *
 * @param lawyerList a list of lawyers' names
 * @param nestedList a nested list of cases, where each case is represented as a list with the lawyer's name as the first element
 * @return a new list containing only the cases that match the lawyer's name
 *
 * Example:
 * findMatchingLists(listOf("John Doe", "Jane Smith"), listOf(listOf("John Doe", "Case A"), listOf("Jane Smith", "Case B"), listOf("John Doe", "Case C")))
 * Output: listOf(listOf("John Doe", "Case A"), listOf("John Doe", "Case C"))
 */
fun findMatchingLists(lawyerList: List<String>, nestedList: List<List<String>>): List<List<String>> {

    val matchingCases = mutableListOf<List<String>>()

    for (case in nestedList) {
        if (case[0] in lawyerList) {
            matchingCases.add(case)
        }
    }

    return matchingCases
}
/**
 * This function takes a list of lawyers and a nested list of cases.
 * It returns a new list that contains only the cases that match the lawyer's name.
 *
 * @param lawyerList a list of lawyers' names
 * @param nestedList a nested list of cases, where each case is represented as a list with the lawyer's name as the first element
 * @return a new list containing only the cases that match the lawyer's name
 *
 * Example:
 * findMatchingLists(listOf("John Doe", "Jane Smith"), listOf(listOf("John Doe", "Case A"), listOf("Jane Smith", "Case B"), listOf("John Doe", "Case C")))
 * Output: listOf(listOf("John Doe", "Case A"), listOf("John Doe", "Case C"))
 */
fun findMatchingLists(lawyerList: List<String>, nestedList: List<List<String>>): List<List<String>> {
/**
 * This function takes a list of lawyers and a nested list of cases.
 * It returns a new list that contains only the cases that match the lawyer's name.
 *
 * @param lawyerList a list of lawyers' names
 * @param nestedList a nested list of cases, where each case is represented as a list with the lawyer's name as the first element
 * @return a new list containing only the cases that match the lawyer's name
 *
 * Example:
 * findMatchingLists(listOf("John Doe", "Jane Smith"), listOf(listOf("John Doe", "Case A"), listOf("Jane Smith", "Case B"), listOf("John Doe", "Case C")))
 * Output: listOf(listOf("John Doe", "Case A"), listOf("John Doe", "Case C"))
 */
fun findMatchingLists(lawyerList: List<String>, nestedList: List<List<String>>): List<List<String>> {

    val matchingCases = mutableListOf<List<String>>()

    for (case in nestedList) {
        if (case[0] in lawyerList) {
            matchingCases.add(case)
        }
    }

    return matchingCases
}