301505: CF284B. Cows and Poker Game

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Cows and Poker Game

题意翻译

奶牛们在玩扑克牌。每个奶牛有一个状态,只可能是 `A`,`F` 或 `I`。状态为 `A` 或 `I` 的奶牛在其他奶牛都是 `A` 或 `F` 的情况下可以摊牌。求最多有多少个奶牛可以摊牌。

题目描述

There are $ n $ cows playing poker at a table. For the current betting phase, each player's status is either "ALLIN", "IN", or "FOLDED", and does not change throughout the phase. To increase the suspense, a player whose current status is not "FOLDED" may show his/her hand to the table. However, so as not to affect any betting decisions, he/she may only do so if all other players have a status of either "ALLIN" or "FOLDED". The player's own status may be either "ALLIN" or "IN". Find the number of cows that can currently show their hands without affecting any betting decisions.

输入输出格式

输入格式


The first line contains a single integer, $ n $ ( $ 2<=n<=2·10^{5} $ ). The second line contains $ n $ characters, each either "A", "I", or "F". The $ i $ -th character is "A" if the $ i $ -th player's status is "ALLIN", "I" if the $ i $ -th player's status is "IN", or "F" if the $ i $ -th player's status is "FOLDED".

输出格式


The first line should contain a single integer denoting the number of players that can currently show their hands.

输入输出样例

输入样例 #1

6
AFFAAA

输出样例 #1

4

输入样例 #2

3
AFI

输出样例 #2

1

说明

In the first sample, cows 1, 4, 5, and 6 can show their hands. In the second sample, only cow 3 can show her hand.

Input

题意翻译

奶牛们在玩扑克牌。每个奶牛有一个状态,只可能是 `A`,`F` 或 `I`。状态为 `A` 或 `I` 的奶牛在其他奶牛都是 `A` 或 `F` 的情况下可以摊牌。求最多有多少个奶牛可以摊牌。

加入题单

算法标签: