diff --git a/d02.cc b/d02.cc index 7e5cf12..9f49b94 100644 --- a/d02.cc +++ b/d02.cc @@ -8,9 +8,9 @@ vector> parse() { vector> input; for (string line; getline(cin, line);) { - if (line.size() < 3 || line[1] != ' ') throw "parse"; - unsigned oppo = line[0] - 'A'; - unsigned user = line[2] - 'X'; + if (line.at(1) != ' ') throw "parse"; + unsigned oppo = line.at(0) - 'A'; + unsigned user = line.at(2) - 'X'; if (oppo >= 3 || user >= 3) throw "parse"; input.push_back({oppo, user}); }