According to the meaning of the question:
2x+4( 18-x)=42
To solve this equation:
x= 15
18-x=3
A: There are 15 chickens and 3 rabbits.