#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
using namespace std;

static ostream& operator<<(ostream& os, const pair<string,double>& e) {
    return os << "[" << e.first << "] (" << e.second << ")";
}

static istream& operator>>(istream& is, pair<string,double>& e) {
    char c;
    // read opening quote, skipping whitespace
    if (is >> c && c == '"') {
        string student;
        // read all chars into student, stop at closing quote, then discard it
        if (std::getline(is, student, '"')) {
            // read a comma, skipping whitespace
            if (is >> c && c == ',') {
                double grade;
                if (is >> grade) {
                    // returns an std::pair of student & grade
                    e = make_pair(student, grade);
                    return is;
                }
            }
        }
    }
    // if we are here, we could not read "student name", grade
    is.setstate(ios_base::failbit);
    return is;
}

void f1(istream& is);
void f2(istream& is);
void f3(const char* filename);

int main(int argc, char** argv) {
    try {
        f1(cin);
        // f2(cin);
        // f3(argv[1]);
    } catch (const exception& x) {
        cerr << x.what() << '\n';
    }
}

void f1(istream& is) {
    while (!is.eof()) {
        is >> std::ws;          // discard leading whitespace
        if (!is || is.eof()) {  // break if nothing else
            break;
        }
        pair<string,double> e;
        is >> e;
        if (is.fail()) {
            break;
        }
        cout << e << '\n';
    }

    if (is.bad()) {
        throw runtime_error{"bad istream"};
    } else if (is.fail()) {
        throw invalid_argument{"bad grade format"};
    }
}

void f2(istream& is) {
    string str;

    while (std::getline(is, str)) {
        istringstream iss(str);

        try {
            f1(iss);
        } catch (const invalid_argument& x) {
            cerr << x.what() << ": " << str << '\n';
        }
    }
}

void f3(const char* filename) {
    ifstream ifs { filename };
    if (!ifs) {
        if (filename != nullptr)
            throw runtime_error{"can't open file: "s + filename};
        else
            throw runtime_error{"no file name provided"};
    }
    f2(ifs);
}
