@cattt For me, it is saying stoi was not declared in this scope, did you recieved the same error?
I assume you'ven't
Can you tell me any input for which you've got the wrong answer, I've just tested for the example input and the output is same as that of example output.