Walmart interview question

write a program to compress given a string.