Duplicate character formatting

https://ide.codingblocks.com/s/55364

error: terminate called after throwing an instance of ‘std::logic_error’ what(): basic_string::_M_construct null not valid

what does this error mean

Hi Kiran, you need to make the following changes to your code:

  1. Change the return type of the duplicate function to ‘void’ instead of string because you’re not returning any string. Also, change line number 9 to return; instead of return 0;
  2. Add a line

cout<<o;

at line number 27 after calling the duplicate function to print the output string.

I have corrected your code, you can refer to it here
https://ide.codingblocks.com/s/55421