Here's why:
* Electron affinity is the change in energy when an electron is added to a neutral atom to form a negative ion. A higher electron affinity means the atom has a greater tendency to gain an electron.
* Oxygen has a smaller atomic radius than sulfur. This means the added electron in oxygen is closer to the nucleus and experiences a stronger attraction. However, oxygen already has a relatively high electronegativity, making it more difficult to add another electron due to electron-electron repulsion.
* Sulfur has a larger atomic radius, placing the added electron further from the nucleus. This weaker attraction is compensated by the fact that sulfur has fewer electrons than oxygen, leading to less electron-electron repulsion and a greater overall attraction for the added electron.
Therefore, despite the smaller size of oxygen, sulfur has a higher electron affinity.