The priority should be
1) NH2
2) -C(CH3)2HS
3) -COOH
4) Hydrogen
The reason the -COOH group (Let's called it C3) has lower priority is that the other carbon is connected to a S (let's call it C2), which has atomic number 16.
So the C3 (-COOH carbon) is connected to O,O,O
The C2 is connected to S,C,C
Since atomic number of S is 16, and atomic number of O is 6 , C2 gets priority. Therefor it is R, not S.
Note that Once one of the 3 atoms the carbon is connected to has higher atomic number, that carbon gets the priority no matter what the other two atoms are.