What does HMS on a ship stand for?

HMS stands for His (or Her) Majesty's Ship Used by nations which have king as head of state, such as the UK, Sweden and Australia etc.