there are dogs and spiders. there are 22 heads and 108 legs. How many spiders and how many dogs are there

since dogs have 4 legs and spiders have 8,

d+s = 22
4d+8s = 108
solve as usual