The root port on a device is the lowest cost interface facing the root bridge. If there's a tie the lowest port ID is selected.
Since you've got a hub in between S2 and S3, S3 is receiving the exact same BPDUs from S2 on both ports and BPDUs from one of its own ports on the other. While this doesn't really hurt S3, S2 will be confused because it receives conflicting BPDUs from two different interfaces of the same bridge on a single interface. Using a hub breaks spanning tree and shouldn't be done.
Additionally, this setup doesn't make much sense. While S3 has two interfaces towards the rest of the network, both interfaces are connected to the same repeater and thus belong to the same collision domain. Only one port can be used at any time.