Time dependent chemical study of contracting interstellar clouds. II. abundances of oxygen- and sulphur-bearing molecules