Let's say I have a map written in ASCII. This map represents the gardens of some people. I have to write a program that, given the map returns how many trees there are in each garden. A mockup map:
+-----------+------------------------------------+
| | B A |
| A A A A | A (Jennifer) |
| | |
| C +--------------+---------------------+
| B C | |
| B C | B B |
| B C | (Marta) |
| B | |
+--------------+ | |
| | | |
| (Peter) B | | A |
| C | (Maria) | |
| A | | |
+--------------+ +---------------------+
| | | |
| | | |
| | | |
| (Elsa) + | (Joe) |
| / | C |
| C A / A + C A A |
| B / A B \ A B |
| B A / C \ B |
+---------+----+---------- +--+------------------+
the output should be something like:
Jennifer B:1 A:1 C:0
Marta B:2 A:1 C:0
Peter A:1 B:1 C:1
...
Joe A:3 B:2 C:2
Is there any package in python or any algorithm that I can study to understand how to perform this task?