Nature of proton transport in a water-filled carbon nanotube and in liquid water