During which stage of the cell cycle does the genetic material replicate so that there are two sets of DNA?

G2 stage

M stage

S stage

G1 stage