Need help in LOSTMAX

need help in this code!

How to convert the whole sentence (taken as string, with spaces) to integers!
I’ve done it in a brute force way, it doesn’t seems to work. please help!

link to the question
link to the code

your code is failing because str isn’t long enough. It should be at least 550. 10^9 has 10 digits, and the spaces also account for one character.

I’m not sure about C, but in C++ you can use a stringstream, like this

Change the following part of your code:

char str[500];

to this:

char str[1000];

NOTE: in this type of problems python comes very handy as there are ready-made functions available in python.
You can refer python based solution: Solution In Python.

Thank you! :blush:
C++ made it so easy :hushed:

Thanks bro!
but python is yet to be studied!