Charm contribution to the proton structure function in deep-inelastic ep scattering at the HERA collider