Walmart Interview Question

write a program to compress given a string.