I accidentally opened the back of my film camera while trying to advance it for the second time. I have not taken any photos yet and the film counter currently shows a "S". Is my unused film ruined due to the exposure to the light?
That depends on the type of camera. I used to have a Fuji auto-loading camera, that would spool the entire film out of the canister first and then every taken photo back into the relative safety of the canister. I'm sure there are other brands that do the same. While this is a nice feature, it does not work to your advantage in this particular case. I would count on the film being lost, although you could still shoot pictures with it and see if anything may come out of it.
This is common beginner mistake. You are fortunate that you did it in the first few shots of the roll.
Only the film that is outside of the canister will have been exposed to daylight ( ruined ) when you opened the camera. So any film inside the canister will be fine.
You use the little black nub on the end of the canister to roll the film back into the canister until just enough leader is left out to load in the camera like it was when the film was fresh out of the box.
Hold the canister with the left hand with the nub on the right and use the right hand to turn the black nub counter clockwise to rewind the film into the canister, it will take several turns to take up the slack before the film starts to be pulled back into the canister.( keep tension on the nub to keep it from releasing ) If you let go of the nub the film will release its tension and un-spool inside the canister and you will have to start over.
Rewind it back so that just the leader and a bit is left outside of the canister, do not wind it all the way in or you will need to buy a special tool to try and get the leader back out.
Load the film into the camera like normal and take several shots to advance the film past where it was at when you opened it. i would say to about 4 or 5.
Act like nothing happened and we wont tell anyone.