Azerbaijan 2022: Qualifying exam in the preparation group for the International Olympiad October 29
Returning to Azerbaijan from Indonesia, while waiting for the next flight at the Doha airport, Said, Omar, Fidan and Fuad decided to play cards in order to "effectively" spend their time.
The standard deck contains 52 cards of 13 different denominations (A, K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3 and 2) and 4 suits (♠, ♣, ♥, ♦). Each player is dealt 13 cards. The total card score of each player is calculated as follows:
- each "ace" (A) is 4 points,
- each "king" (K) is 3 points,
- each "queen" (Q) is 2 points,
- each "jack" (J) is 1 points,
- other cards (in this case we shall mark them as X) count as 0 points.
Since Fuad is new to this game, he first practiced scoring. Thus, the cards were dealt n times, and each time Fuad counted the points of his cards. In the end, he counted all the points.
Now he wants to know if he has calculated the total points correctly or not. Write a program to help him with this task.
The first line contains n (1 ≤ n ≤ 10000) integers. Each of the following n lines contains a row of 13 cards, consisting only of characters 'A', 'K', 'Q', 'J', 'X'.
Print the total score for Fuad.
3 JQXAXJXQXAXKJ KAXXAJXKXXXKJ XAXAAJXQXAKKJ