I want to compress a bigger string into a smaller string in C++. What are the different ways to do this in C++? The requirement is that output should also be a string.
Well, if you don't need to uncompress it later:
string s = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; s = "";
Edit: Sounds like you want a hash function - there are a zillion out there, depending on your requirements. Google is your friend.