My requirement is to truncate the string with max count and based on some conditions. The conditions are,