This assumes S and S~ are path connected, so that the concept of a fundamental group makes sense. Covering spaces are locally path connected, but if we're talking about fundamental groups, we will assume the spaces are path connected as well.
Let S be the figure 8, two circles tangent at a point. Let the point of tangency be the base point for evaluating the fundamental group. When a path spends a portion of its life in the top loop, it has a degree, like any closed path in a circle. A homotopy carries this section of the path to zd, where d is the degree. In other words, the path winds around the circle d times. If d is 0 the path just sits there at the point of tangency. If d is negative it runs the circle clockwise instead of counterclockwise.
Now the path is ready to go around the bottom circle, and this too is homotopic to a simple winding of degree d. If d is 0, this entire excursion disappears, and the previous and subsequent trips around the top circle can be combined, giving a new degree. In the end, the path is represented by a word in the free group generated by A and B. Here A runs around the top circle and B runs around the bottom. A word like A3B5A-2 runs around the top circle three times, then around the bottom circle 5 times, then around the top circle backwards, 2 times.
Are these homotopy classes distinct?
Select the shortest word that is homotopic to some other word in the free group. Without loss of generality, let this word start with A. The rest of the word can only be homotopic to itself, so a homotopy carries A to some other word. A continuous projection squashes B onto the base point, leaving only the circle above. Push the homotopy through this projection, and A has to be homotopic to A. To be different, A must be preceded, or followed, by a power of B. The portion of the path prior to A cannot change its B degree from 0 to something nonzero, nor can the section of the path that follows A change its B degree. Only A is homotopic to A, and that completes the inductive step. Therefore the words in the free group on A and B correspond to distinct homotopy classes.
Since every word is finite, i.e. every path traces a finite number of circles, we have indeed described all the homotopy classes of the figure 8, and its fundamental group is the free group on A and B. This generalizes to n circles tangent at a point. The fundamental group becomes free on n generators.
Now we need a covering space for the figure 8.
Start with the real line and attach a small circle to every integer. These circles are tangent to the real line. The projection p wraps the real line around the top circle of the figure 8 in the usual way, and the small tangent circles all map to the bottom circle.
What is the fundamental group of this space? Let a closed path start at the origin. Each trip into an adjunct circle has a degree, and a homotopy transforms this part of the path to zd. The path exits this circle and moves to another, say from 7 to 19. This can be accomplished by a linear map from 7 to 0 to 19. Any to paths in R1 are homotopic, so after an appropriate homotopy, the path indeed goes from 7 to 0 to 19, ready to drop into the circle at 19. The path is now a concatenation of trips to various circles. A trip moves from 0 to k, runs around the circle d times, and returns to 0. If each circle is associated with a generator, then each closed path is a word in the free group on countably many generators. For instance, G24G59 runs to the second circle, winds around it 4 times, goes back to the origin and out to the fifth circle, winds around that 9 times, and returns to the origin.
If a homotopy is applied to a path, the first term in the path cannot change, because that would change the degree of the circle in question. In fact none of the terms can change, as we argued above for the figure 8. Therefore the fundamental group is the free group on a countable set of generators.
Now for the interesting part. The free group on infinitely many generators embeds in the free group on two generators. In fact the topology provides the monomorphism. The generator Gn in the covering space maps to AnBA-n. Once discovered, this theorem can be proved algebraically, but the topological proof is somewhat unexpected. Algebraic topology often uses algebra to prove a topological theorem, but in this case topology proves a theorem in algebra.
Given any path from p back to p, one can normalize the trips around each circle, corresponding to the degree. This is similar to what we did above. Within the free group on A B and C, a homotopy class consists of powers of B (positive or negative) with powers of A and C in between. It is not possible to jump from C up to A, without passing through B. On each transition from C to B to A, or from A to B to C, the power of B is a half integer. Move from C to A by traveling halfway around B counterclockwise, and the degree is ½. Travel halfway around clockwise and the degree is -½. The exponents on A and C are always integers. The exponent on B is a whole integer if we are returning to the circle that we just left. A half integer is once again required if the word begins with B A or ends with A B. This is because the base point p is technically part of circle C.
The only thing that is really new here is the half integers. Let q be the point of tangency between B and A. Pull A around clockwise until it coincides with C, whence q coincides with p. Now the path around B starts and ends at p, and has a traditional degree. Pull q back into position and find a path with a half degree. Therefore the half degrees represent all the distinct homotopy classes of paths from p to q, or q to p, within B. From here the reasoning is the same. Every path is homotopic to one of our prescribed words in A B and C, and these words represent distinct homotopy classes.
Start with a torus and cut a hole in the left and right sides. The remaining surface retracts onto the circle on the inside of the doughnut, and the two radial circles above and below. Call these circles A B and C, from top to bottom. The loop that defines the hole in the right side of the tire pulls back to a path around the three circles, starting at p, with the formula B½AB-½C. Or, if the loop runs the other direction, you might get a formula like B½A-1B-½C-1. The loop that cuts the hole on the left makes a similar formula, but the exponents on B are swapped. B-½AB½C.
These formulas are distinct. The loops that cut holes on opposite sides of a torus are not homotopic. And it doesn't matter whether the loops, when viewed as paths, run clockwise or counterclockwise.
This result becomes intuitive if you picture a loop on the right, which begins life as the boundary for the hole on the right. Try to slide it across, to surround the hole on the left, but it can't get past the opening in the middle.