Math Problem of the Day

There are $3$ dinosaurs, $3$ hippos, $3$ flamingos, and $5$ giraffes. Find the number of ways to arrange the animals in a line such that each animal is next to at least one other animal of the same species.

Bonus: Find the number of ways to arrange the animals in a circle under the same constraints. Two arrangements are equivalent if one can be rotated to form the other.