Mass of oxygen : 54 g
Conservation of mass applies to a closed system, where the masses before and after the reaction are the same
Reaction
[tex]\tt C+O_2\rightarrow CO_2[/tex]
mass before reaction = mass after reaction
mass C + mass O₂= mass CO₂
[tex]\tt 18~g+mass~O_2=72~g\\\\mass~O_2=72-18=\boxed{\bold{54~g}}[/tex]