implemented string compressor algorithm