Final answer:
The animal shelter initially had 27 dogs for adoption.
Step-by-step explanation:
To find the total number of dogs the shelter had for adoption, we can set up an equation. Let d represent the number of dogs the shelter had initially. We know 14 dogs were adopted last week and 8 dogs were adopted this week. Therefore, the equation is: d - 14 - 8 = 5. Simplifying the equation, we get d - 22 = 5. Adding 22 to both sides, we have d = 27. Therefore, the shelter had 27 dogs for adoption initially.