Notes
This function is in beta test. Please help improve it in the issues
here.
================================================================= ==46171==ERROR: AddressSanitizer: negative-size-param: (size=-1) #0 0x4dc20c (/out/package/ex6+0x4dc20c) #1 0x5154b0 (/out/package/ex6+0x5154b0) #2 0x515778 (/out/package/ex6+0x515778) #3 0x7fb2df952b96 (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #4 0x41c9e9 (/out/package/ex6+0x41c9e9) 0x7fb2dccdaa0d is located 525 bytes inside of 1200000-byte region [0x7fb2dccda800,0x7fb2dcdff780) allocated by thread T0 here: #0 0x4dc8a0 (/out/package/ex6+0x4dc8a0) #1 0x514e5e (/out/package/ex6+0x514e5e) #2 0x515778 (/out/package/ex6+0x515778) #3 0x7fb2df952b96 (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) SUMMARY: AddressSanitizer: negative-size-param (/out/package/ex6+0x4dc20c) ==46171==ABORTING
Hints
Your answer may be identical to the JOJ answer in the first several lines.
However, the main problem you meet now is Runtime Error. And the exit code of your program is 1, which should be 0.
Please double check your code to solve this problem and try again.
Your Answer
JOJ Answer
Input a string: * Choose 1 to replace a character or 2 to delete a character: Delete character: New string: b b b bbbbb bb bb bb b b b b b b b bb bbb b b b bbb bbb b