I was trying to solve a problem from codewars and it seems like I have a problem with my output.
This is the problem I am trying to solve
The code works when I run it on codeblocks. There is a missing " in the output and I think that is due to the NULL character that I am adding at the end of the string. My code is not meant to output any quotation marks, and I think that the NULL character interferes with the website's code, erasing their last quotation mark. Can anybody help me? Thank you! This is the code:
#include <string.h>
std::string to_camel_case(std::string a)
{
    int q = a.size();
    for (int i = 0; i < q; i++)
        if (a[i] == '-' || a[i] == '_') {
            if (a[0] > 96 && a[0] < 123)
                a[i + 1] = a[i + 1] - 32;
            for (int j = i; j < q - 1; j++) {
                a[j] = a[j + 1];
            }
            a[q - 1] = 0;
        }
    return a;
}
 
     
     
    