The process will probably take place at constant volume, if it happens in a closed container.
So the molar heat capacities will be 3R for CO2 and 2.5R for O2
Let the final temperature be T.
Heat recieved by CO2 = Heat given by O2
3R(T-27)(22/44) = 2.5R(37-T)(16/32)
Solve it to get T = 31.55 degrees approx.
On the other hand, if it is given that the process takes place at constant pressure, then the heat capacities will be 4R for CO2 and 3.5R for O2.
4R(T-27)(22/44) = 3.5R(37-T)(16/32)
Solve to get T = 31.66 degrees approx.