Please help if possible.

Example:

A1 ----- B1 --- C1 --- D1 --- E1 --- F1 -----G1

CAT --- CAT ---Dog ----Dog ----Dog --- CAT --- CAT




A2 ---- B2 -----C2 ----- D2 -------E2 -------F2 --------G2
CAT ---DOG ---DOG ----Sheep ---Sheep --Monkey ---Monkey



Can you help come up with a formula to answer 2 for the number of changes in the array A1:G1, and 3 in the array A2:G2?

Thank you.
-Andrew