SIGCONT Errors

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.

I don’t know why you don’t want to share the question source.

Because it doesn’t really matter to the question. And this code will be a answer for one of their questions.

If there’s a reason you need to know where it comes from feel free to ask, but the code and the input is what’s important.

It’s because I’m not getting SIGCONT error from any of the inputs. With or Without keeping your commented statements. Your code seems okay. But I can’t assure you its perfect until I have the exact question.

Fair enough. It’s taken from adventofcode.com. Each input is unique so mine is available at https://pastebin.com/6mMqQSAc

I just tried it again, that Custom input on a single line, and that code gave me a SIGCONT.

You exceeded the IDE’s printing limit. Hence you are getting SIGCONT.

For Codechef IDE, it’s around 2^16 Characters.

You can try printing the output directly in a file locally.

But as you are using chrome os, I doubt if you can compile and execute locally. Mostly, you’d be using online compilers. If so, then check out geeksforgeeks IDE which has a higher limit. Also, you can install linux on Chromebook. You’d definitely find how to do so on the internet.

I knew it would be something foolish. That completely makes sense. And outputting that string would get me near the limit as well.

Thank you very much Black_truce. I appreciate your time and will consider if I need that much output (I probably don’t).

1 Like