/**
 * This function formats the patient's full name with a preferred title, using string formatting.
 *
 * @param firstName The first name of the patient.
 * @param lastName The last name of the patient.
 * @return The formatted full name with title.
 */
fun formatPatientNames(firstName: String, lastName: String): String {

    // Provide a preferred title: Dr., Mr., Mrs., Ms.
    val title = "Dr."

    // Use negative indexing to get the last character of the last name
    val lastInitial = lastName.last()

    // Concatenate the preferred title, first name, and the last initial
    val formattedName = "$title $firstName $lastInitial."

    return formattedName
}
/**
 * This function formats the patient's full name with a preferred title, using string formatting.
 *
 * @param firstName The first name of the patient.
 * @param lastName The last name of the patient.
 * @return The formatted full name with title.
 */
fun formatPatientNames(firstName: String, lastName: String): String {
/**
 * This function formats the patient's full name with a preferred title, using string formatting.
 *
 * @param firstName The first name of the patient.
 * @param lastName The last name of the patient.
 * @return The formatted full name with title.
 */
fun formatPatientNames(firstName: String, lastName: String): String {

    // Provide a preferred title: Dr., Mr., Mrs., Ms.
    val title = "Dr."

    // Use negative indexing to get the last character of the last name
    val lastInitial = lastName.last()

    // Concatenate the preferred title, first name, and the last initial
    val formattedName = "$title $firstName $lastInitial."

    return formattedName
}