```
#include<bits/stdc++.h>
#include <iostream>
#include<string>
using namespace std;

int main() {
    int t;
    cin>>t;
    while(t--){
        string s;
        cin>>s;
        string x = "";
        int y = 0;
        for(int i = 0; i<s.length(); i++){
            if(s[i] < 'A'){
                x = x + s[i];
            }
            else if(s[i] > 'A'){
                y = y + std::stoi(x);
                x = "";
            }
        }
        cout<<y;
    }
}

```

And the error thrown is:

> 
> terminate called after throwing an instance of 'std::invalid\_argument'
>  what(): stoi
> 
> 
>