Duplicate character formatting

the folllowing code is showing error

control reaches end of non void function

@nischay1111
Actually during compilation, your program reach end of duplicate() function and doesn’t find any return string. Program stuck if none of the “if” statement is not true (only we know this would never happens). So simply change line 22 to “else” and after line 32 write cout<<p; Your code will work for all testcases.

Worked and very well explained

Thanks for help ! :slight_smile: