Chemical bonding of water to metal surfaces studied with core-level spectroscopies