Day 6 - Roosevelt Arch

The road from Roosevelt Arch to Mammoth teems with animals, but you can only see some of them. You can only see animals that are surrounded by grass and only those animals that are taller than the grass around them. There are some animals you can never see, because they blend into the grass.

You can see elk, bison, wolves, pronghorn, moose, cranes, and bears. You can’t see any other animals, like bobcats and coyotes.

A single input string describes all the animals and their surroundings. The input string contains strings like this:

Surroundings (examples):

Animals (examples):

For example, you can see these animals:

For example, you can’t see these animals:

In this example input, you a see a bison and a moose:

(tree,21)(rock,35)(grass,28)(rock)(bobcats,37)(tree)(grass,36)(rock,30)(tree,31)(tree)(otter,39)(tree)(tree,6)(rock,27)(tree,38)(grass,9)(moose,27)(grass,24)(rock,47)(tree,18)(rock,31)(tree)(sheep,28)(rock)(grass,43)(rock,43)(tree,18)(rock)(bobcats,39)(rock)(rock,30)(grass,42)(grass,7)(rock)(coyote,23)(rock)(tree,26)(grass,23)(tree,20)(tree)(bear,27)(tree)(rock,29)(rock,31)(grass,29)(tree)(crane,47)(grass,6)(grass,14)(grass,36)(grass,27)(grass,32)(sheep,47)(tree)(grass,34)(grass,8)(grass,20)(grass,17)(bison,44)(grass,43)(grass,8)(grass,26)(rock,39)(tree,15)(tree,14)

How many animals can you see?

Input

Test input

Hints

Copyright 2022 Robin A. Reynolds-Haertle