nit: if s is an empty string, it might fail.