/**
 * Given a list of firefighter names, write a program to create new lists based on certain conditions.
 *
 * @param names List of strings representing firefighter names.
 * @return A list of lists containing firefighters' names.
 */
fun firefighterPlatoon(names: List<String>): List<List<String>> {

    val experiencedFirefighters = mutableListOf<String>()
    val inexperiencedFirefighters = mutableListOf<String>()

    for (name in names) {
        if (name[0] == 'F' && name.last() == 'r' && name.length == 5) {
            experiencedFirefighters.add(name)
        } else if (name[0] == 'J' && name.last() == 'y' && name.length == 6) {
            inexperiencedFirefighters.add(name)
        }
    }

    return listOf(experiencedFirefighters, inexperiencedFirefighters)
}
/**
 * Given a list of firefighter names, write a program to create new lists based on certain conditions.
 *
 * @param names List of strings representing firefighter names.
 * @return A list of lists containing firefighters' names.
 */
fun firefighterPlatoon(names: List<String>): List<List<String>> {
/**
 * Given a list of firefighter names, write a program to create new lists based on certain conditions.
 *
 * @param names List of strings representing firefighter names.
 * @return A list of lists containing firefighters' names.
 */
fun firefighterPlatoon(names: List<String>): List<List<String>> {

    val experiencedFirefighters = mutableListOf<String>()
    val inexperiencedFirefighters = mutableListOf<String>()

    for (name in names) {
        if (name[0] == 'F' && name.last() == 'r' && name.length == 5) {
            experiencedFirefighters.add(name)
        } else if (name[0] == 'J' && name.last() == 'y' && name.length == 6) {
            inexperiencedFirefighters.add(name)
        }
    }

    return listOf(experiencedFirefighters, inexperiencedFirefighters)
}