#include <iostream>
#include <vector>
#include <sstream>
using namespace std;

int main() {
	string s("1.657e-01,4.8552e-01,8.7585e-01");
	vector<double> data;
	for (istringstream iss(s); ; ) {
		double x;
		iss >> x;
		if ( ! iss) {
			cout << "Parse error" << endl;
			break;
		}
		data.push_back(x);
		char comma = 0;
		iss >> comma;
		if ( ! iss)
			break;
		if (',' != comma) {
			cout << "What is [" << comma << "]?" << endl;
			break;
		}
	}
	
	cout << "Parsed " << data.size() << " pieces of data" << endl;
}