- e.g. if I have an object std::ifstream fin("file.txt");,
I can read in the first space-delimited token of that file by doing:
1 2
int my;
fin >> my_int;
or perhaps
1 2
std::string str;
fin >> str;
But also, std::getline() can be used to parse a stream by more than just whitespace, e.g. you could delimit each token by a comma:
1 2
std::string line;
std::getline(fin, line, ',');
In your case, a good start would be to simply read in each space-delimited token with the >> operator. Ignore the token of it's a "{", "}", ":", or "week", do something special if it's a number (e.g. 5), but then actually parse the string more on your own if the string looks like "('AA','BB'),".
Also, a bit more complicated, but a string can always be turned back into another stream by using an std::stringstream. You can search that if you want examples. This allows you to parse part of a line, which was already the output of a stream, as another stream.