just implementing the most basic form of string compression