If you goto Japan, you will notice everyone keeps thanking everyone as they are very polite. So remember these words:
Domo - Thanks (Informal)
Arigato - Thanks (Informal)
Arigato Gozaimasu - Thank you (Formal)
Domo Arigato - Thank you (Formal)
Domo Arigato Gozaimasu - Thank you very much (very formal)
Arigato Gozaimashita - Thank you for all you have done (very formal). Told while leaving someone who helped you are lot for long time.
When someone thanks you the reply is: