Duplicate character formatting

this worked but , if a condition comes where the string is “helllo” then how to solve that or what are the changes that will be needed

Hi @vikashkmr519,
You can add a while loop in the code to check for the number of times the individual character is occuring …
check the changes and the comment in the code.