/**
 * Create a set of police officer names while avoiding infinite loops.
 *
 * @param policeOfficer The name of the Police Officer.
 * @param infiniteLoops Determines whether to use infinite loops or not.
 * @return A set containing the names of other police officers.
 */
fun createSet(policeOfficer: String, infiniteLoops: Boolean): Set<String> {

    val officersSet = mutableSetOf<String>()

    if (infiniteLoops) {
        while (true) {
            print("Enter the name of a police officer (Type 'exit' to finish): ")
            val name = readLine() ?: ""
            if (name.equals("exit", ignoreCase = true)) {
                break
            }
            officersSet.add(name)
        }
    } else {
        println("Creating a set of police officers for $policeOfficer...")
    }

    return officersSet
}
/**
 * Create a set of police officer names while avoiding infinite loops.
 *
 * @param policeOfficer The name of the Police Officer.
 * @param infiniteLoops Determines whether to use infinite loops or not.
 * @return A set containing the names of other police officers.
 */
fun createSet(policeOfficer: String, infiniteLoops: Boolean): Set<String> {
/**
 * Create a set of police officer names while avoiding infinite loops.
 *
 * @param policeOfficer The name of the Police Officer.
 * @param infiniteLoops Determines whether to use infinite loops or not.
 * @return A set containing the names of other police officers.
 */
fun createSet(policeOfficer: String, infiniteLoops: Boolean): Set<String> {

    val officersSet = mutableSetOf<String>()

    if (infiniteLoops) {
        while (true) {
            print("Enter the name of a police officer (Type 'exit' to finish): ")
            val name = readLine() ?: ""
            if (name.equals("exit", ignoreCase = true)) {
                break
            }
            officersSet.add(name)
        }
    } else {
        println("Creating a set of police officers for $policeOfficer...")
    }

    return officersSet
}