Altimetrik interview question

Write a java code to compress String