#C5805. Flower Cell Identification

    ID: 49495 Type: Default 1000ms 256MiB

Flower Cell Identification

Flower Cell Identification

In this problem, you are given a garden represented as a grid with M rows and N columns. Each cell in the garden contains a single character that represents the type of flower planted, or '-' if the cell is empty. You will also be given a specific flower type to search for. Your task is to find all occurrences of the specified flower type in the garden and output their coordinates (row and column indices, starting from 0).

If the specified flower is found at one or more cells, output the list of coordinates in the following format:

[(i1, j1), (i2, j2), ...]

If the flower is not found anywhere in the garden, print "Not Found".

Note: All indices are 0-based. Ensure your program reads from standard input (stdin) and writes to standard output (stdout).

inputFormat

The input is given in the following format:

  • The first line contains two integers M and N, representing the number of rows and columns, respectively.
  • The next M lines each contain N space-separated characters, representing the garden grid.
  • The last line contains a single character, representing the flower type to search for.

For example: 4 5 R - Y B G G R G B - Y - B G R

  • B - - Y G

outputFormat

Print the coordinates of each cell that contains the specified flower type as a list of tuples, formatted as: [(i1, j1), (i2, j2), ...] If there is no occurrence of the specified flower type, output "Not Found".## sample

4 5
R - Y B G
G R G B -
Y - B G R
- B - - Y
G
[(0, 4), (1, 0), (1, 2), (2, 3)]