/**
 * Given a list of names, return the first and last name in the list.
 *
 * Example:
 * nameList = listOf("Brad Pitt", "Angelina Jolie", "Leonardo DiCaprio")
 * getFirstAndLast(nameList) -> listOf("Brad", "DiCaprio")
 *
 * @param nameList A list of actor/actress names (String)
 * @return A list containing the first and last names (String)
 */
fun getFirstAndLast(nameList: List<String>): List<String> {

    // Obtain the first and last names from the provided list
    val firstName = nameList[0].split(" ")[0]
    val lastName = nameList.last().split(" ").last()

    return listOf(firstName, lastName)
}
/**
 * Given a list of names, return the first and last name in the list.
 *
 * Example:
 * nameList = listOf("Brad Pitt", "Angelina Jolie", "Leonardo DiCaprio")
 * getFirstAndLast(nameList) -> listOf("Brad", "DiCaprio")
 *
 * @param nameList A list of actor/actress names (String)
 * @return A list containing the first and last names (String)
 */
fun getFirstAndLast(nameList: List<String>): List<String> {
/**
 * Given a list of names, return the first and last name in the list.
 *
 * Example:
 * nameList = listOf("Brad Pitt", "Angelina Jolie", "Leonardo DiCaprio")
 * getFirstAndLast(nameList) -> listOf("Brad", "DiCaprio")
 *
 * @param nameList A list of actor/actress names (String)
 * @return A list containing the first and last names (String)
 */
fun getFirstAndLast(nameList: List<String>): List<String> {

    // Obtain the first and last names from the provided list
    val firstName = nameList[0].split(" ")[0]
    val lastName = nameList.last().split(" ").last()

    return listOf(firstName, lastName)
}