#C5783. Taco: Grid Dominance
Taco: Grid Dominance
Taco: Grid Dominance
In this problem, Alice and Bob are engaged in a simple grid game. You are given an \(n \times n\) grid where each cell is either an 'X' or an 'O'. The game is played as follows: if the total number of 'X's in the grid is strictly greater than the total number of 'O's, then Alice wins; otherwise, Bob wins.
Your task is to determine the winner based on the grid configuration. The decision rule can be expressed mathematically as:
\[ \text{Winner} = \begin{cases} \text{Alice} & \text{if } \#X > \#O, \\ \text{Bob} & \text{otherwise}. \end{cases} \]
This problem tests your ability to process grid data and implement a simple counting algorithm correctly.
inputFormat
The input is provided via standard input (stdin) and has the following format:
- The first line contains an integer \(n\), representing the size of the grid.
- The following \(n\) lines each contain a string of length \(n\) composed solely of the characters 'X' and 'O', representing a row of the grid.
For example:
3 XOX OXO XOX
outputFormat
Output a single line to standard output (stdout) containing either "Alice" or "Bob" depending on the winner determined by the rule that if the count of 'X' is strictly greater than the count of 'O', then Alice wins; otherwise, Bob wins.
For the sample input above, the correct output would be:
Alice## sample
3
XOX
OXO
XOX
Alice
</p>