#K76332. Fruit Basket Count
Fruit Basket Count
Fruit Basket Count
You are given a basket of fruits represented by a string. Each character in the string is either 'A' (representing an apple) or 'O' (representing an orange). The first input line provides an integer (N) which is the total number of fruits, and the second line provides a string of length (N) that contains only the characters 'A' and 'O'.
Your task is to count the number of apples and oranges in the basket.
Formally, if the string is denoted by (s), then:
( \text{apple_count} = \sum_{i=1}^{N} [ s_i = 'A' ] )
( \text{orange_count} = \sum_{i=1}^{N} [ s_i = 'O' ] )
where ([P]) is the indicator function that is 1 if the proposition (P) is true, and 0 otherwise.
Output the two counts (apples and oranges) separated by a space.
inputFormat
The input is read from standard input. The first line contains an integer (N) representing the number of fruits. The second line contains a string of length (N) consisting only of characters 'A' and 'O'.
outputFormat
Output to standard output the number of apples and the number of oranges, separated by a space.## sample
5
AAOOA
3 2