#include <iostream>
#include <sstream>
using namespace std;
int main() {
string a = "1, 2, 3, 4, 5, 6, 10, 2, 11";
int sum = 0;
for(int i = 0; i<a.length(); ++i) {
if(isdigit(a[i])){
if(!isdigit(a[i+1])) {
string temp; temp = a[i];
sum+=stoi(temp);
}
else {
stringstream temp; temp << a[i];
temp << a[i+1];
int temptemp = 0;
temp >> temptemp;
sum += temptemp;
cout << sum;
#include <iostream>
#include <sstream>
using namespace std;
int main() {
string a = "1, 2, 3, 4, 5, 6, 10, 2, 11";
int sum = 0;
for(int i = 0; i<a.length(); ++i) {
if(isdigit(a[i])){
if(!isdigit(a[i+1])) {
string temp; temp = a[i];
sum+=stoi(temp);
}
else {
stringstream temp; temp << a[i];
temp << a[i+1];
int temptemp = 0;
temp >> temptemp;
sum += temptemp;
}
}
}
cout << sum;
}