Barclays Interview Question

count occurrences of character in string.