Hello,
So I have a rather simple program, with a rather large text entry. Allow me to show you some simple C++ code.
#include #include using namespace std; int main() { // your code goes here std::string input; input.reserve(60000); cin >> input; bool repeat = true; do { repeat =false; for ( auto it = input.begin(); it != input.end(); ++it ) { auto nextchar = next(it); if( *it - *nextchar == 32 || *nextchar - *it == 32 ) { repeat = true; input.erase( it, ++nextchar); break; } } //cout << "String is " << input << endl; cout << "Did a loop\n"; } while (repeat == true); cout << "String length is " << input.length() << endl; return 0; }
Seems simple.
But my input is MASSIVE. But I think it’s killing the query here so here’s about 30 characters You can dupe it 1000 times to get a realistic input.
RrhGgHUQOzZoeErRpPBbiIhHquNnHhUgGsSbBZzNXfFxnRrupaoOXxrRAaAPDdNORnNDdrCc
If you run this code it seems to run and then throws an error SIGCONT. It seems like I’m tripping something. remove the Did a Loop output, and everything runs fine. Move the string length count into the do while loop, it throws SIGCONT again? the code only executes .01 seconds, but it seems like it doesn’t like the output.
I really like Codechef, and I’m using it to write simple code for … well I don’t want to say where this code is from (Spoilers), but things like project Euler and similar, but that error seems to limit my debugging capabilities here. I use a Chromebook at home so Codechef is super useful for me, so is there anyway around this?
Thanks for the answer, and I hope this isn’t a really stupid question.