/**
 * Given the notes of a Physical Therapist and a target word, count the number of times the target word is mentioned.
 *
 * @param therapistNotes A string containing the notes written by the Physical Therapist.
 * @param targetWord A string representing the word to be counted in the therapistNotes.
 * @return An integer representing the number of times the target word appears in the therapistNotes.
 */
fun countRepetitions(therapistNotes: String, targetWord: String): Int {

    // Remove punctuation marks from the therapist notes
    var cleanedNotes = therapistNotes.replace(",", "").replace(".", "").replace(";", "")

    // Convert the therapist notes to a list of individual words
    val words = cleanedNotes.split(" ")

    // Initialize a counter variable to keep track of the number of occurrences of the target word
    var count = 0

    try {
        // Iterate through each word in the therapist notes
        for (word in words) {
            // Perform case-sensitive comparison of the word with the target word
            if (word == targetWord) {
                count++
            }
        }
    } catch (e: Exception) {
        // Handle any unforeseen errors that may occur during the counting process
        return -1
    }

    return count
}
/**
 * Given the notes of a Physical Therapist and a target word, count the number of times the target word is mentioned.
 *
 * @param therapistNotes A string containing the notes written by the Physical Therapist.
 * @param targetWord A string representing the word to be counted in the therapistNotes.
 * @return An integer representing the number of times the target word appears in the therapistNotes.
 */
fun countRepetitions(therapistNotes: String, targetWord: String): Int {
/**
 * Given the notes of a Physical Therapist and a target word, count the number of times the target word is mentioned.
 *
 * @param therapistNotes A string containing the notes written by the Physical Therapist.
 * @param targetWord A string representing the word to be counted in the therapistNotes.
 * @return An integer representing the number of times the target word appears in the therapistNotes.
 */
fun countRepetitions(therapistNotes: String, targetWord: String): Int {

    // Remove punctuation marks from the therapist notes
    var cleanedNotes = therapistNotes.replace(",", "").replace(".", "").replace(";", "")

    // Convert the therapist notes to a list of individual words
    val words = cleanedNotes.split(" ")

    // Initialize a counter variable to keep track of the number of occurrences of the target word
    var count = 0

    try {
        // Iterate through each word in the therapist notes
        for (word in words) {
            // Perform case-sensitive comparison of the word with the target word
            if (word == targetWord) {
                count++
            }
        }
    } catch (e: Exception) {
        // Handle any unforeseen errors that may occur during the counting process
        return -1
    }

    return count
}