/**
 * As a game developer, you are working on a project where you need to count the number of times a specific
 * character appears in a given string. Your task is to complete the 'findCharacters' function above.
 *
 * Your goal is to accurately count the occurrences of the target character, using a loop. You need to
 * increment the 'count' variable each time you find a match with the target character.
 *
 * Remember to test your function with different inputs to ensure it is working correctly.
 *
 * Good luck!
 */
fun gameDeveloperTask() {

    // Specifying a test case
    val string = "abracadabra"
    val target = 'a'

    // Calling the 'findCharacters' function with the specified test case
    val result = findCharacters(string, target)
    println("The target character '$target' appears $result times")
}

fun findCharacters(string: String, target: Char): Int {
    var count = 0
    for (char in string) {
        if (char == target) {
            count++
        }
    }
    return count
}
/**
 * As a game developer, you are working on a project where you need to count the number of times a specific
 * character appears in a given string. Your task is to complete the 'findCharacters' function above.
 *
 * Your goal is to accurately count the occurrences of the target character, using a loop. You need to
 * increment the 'count' variable each time you find a match with the target character.
 *
 * Remember to test your function with different inputs to ensure it is working correctly.
 *
 * Good luck!
 */
fun gameDeveloperTask() {
/**
 * As a game developer, you are working on a project where you need to count the number of times a specific
 * character appears in a given string. Your task is to complete the 'findCharacters' function above.
 *
 * Your goal is to accurately count the occurrences of the target character, using a loop. You need to
 * increment the 'count' variable each time you find a match with the target character.
 *
 * Remember to test your function with different inputs to ensure it is working correctly.
 *
 * Good luck!
 */
fun gameDeveloperTask() {

    // Specifying a test case
    val string = "abracadabra"
    val target = 'a'

    // Calling the 'findCharacters' function with the specified test case
    val result = findCharacters(string, target)
    println("The target character '$target' appears $result times")
}

fun findCharacters(string: String, target: Char): Int {
    var count = 0
    for (char in string) {
        if (char == target) {
            count++
        }
    }
    return count
}