#C2254. Animal Grid Validator
Animal Grid Validator
Animal Grid Validator
You are given a grid that is supposed to represent the positions of animals in a 10 ( \times ) 10 grid. Each cell in the grid is represented by a character. The only valid characters are 'A' (representing an animal) and '.' (representing an empty cell). The grid is valid if and only if it meets the following criteria:
- The grid consists of exactly 10 rows.
- Each row has exactly 10 characters.
- There are exactly 10 occurrences of 'A' in the entire grid.
If any of these conditions fail, the grid is invalid.
Your task is to write a program that accepts the grid from standard input (stdin) and prints "Valid" if the grid meets all the conditions, or "Invalid" otherwise.
For example, a valid grid would be:
A......... .A........ ..A....... ...A...... ....A..... .....A.... ......A... .......A.. ........A. .........A
This grid is valid because it is a 10 ( \times ) 10 grid and contains exactly ten 'A's.
inputFormat
The input is read from standard input (stdin) and consists of exactly 10 lines, where each line is a string of exactly 10 characters. Each character will be either 'A' or '.'.
outputFormat
Print a single line to standard output (stdout): either "Valid" if the grid is valid according to the rules above, or "Invalid" otherwise.## sample
A.........
.A........
..A.......
...A......
....A.....
.....A....
......A...
.......A..
........A.
.........A
Valid