X270: Recursion Programming Exercise: Count Character A

For function countChr() write the missing part of the recursive call. This function should return the number of times that the letter "A" appears in string "str".
Recall that str.substring(a) will return the substring of str from position a to the end of str, while str.substring(a, b) will return the substring of str starting at position a and continuing to (but not including) the character at position b.

Examples:

countChr("ctcowcAt") -> 1

Your Answer:

Feedback

Your feedback will appear here when you check your answer.