Pregunta de entrevista de Amazon

Write an algorithm to compress a string?