Daily Dog Pooh

In every city there are shelters in which such animals as dogs live.
Today we will work in the game Daily Dog Pooh in one of them.
Your task is to detect the heaps that piled the dogs.
Before you on the screen you will see the playing field divided into cells.
In some of them dogs will be visible, and in others heaps.
You will need to make moves to arrange exactly the same objects in the places you need.
In this case, you will need to arrange them in one column or line.
At the same time there must be an equal number of dogs and dogs.
There should never be more than two dogs or two poohs next to each other, horizontally or vertically. Each row and column contain the same number of dogs and poohs.