Compress the given string if compressed str is less than given str