284B.md (1428B)
1 Source: https://codeforces.com/problemset/problem/284/B 2 3 B. Cows and Poker Game 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 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". 22 23 Find the number of cows that can currently show their hands without affecting any betting decisions. 24 25 Input 26 27 The first line contains a single integer, *n* (2 ≤ *n* ≤ 2·105). 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". 28 29 Output 30 31 The first line should contain a single integer denoting the number of players that can currently show their hands. 32 33 Examples 34 35 Input 36 37 ``` 38 6 39 AFFAAA 40 ``` 41 42 Output 43 44 ``` 45 4 46 ``` 47 48 Input 49 50 ``` 51 3 52 AFI 53 ``` 54 55 Output 56 57 ``` 58 1 59 ``` 60 61 Note 62 63 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.