Pergunta de entrevista da empresa Comcast

Pattern printing, print characters one time even if they are duplicated in a string without any collections. example: String s="elephant" and output is "elphant".