From 91f860a3d26864ddf0c2b59258c1c4dcfbc9fedd Mon Sep 17 00:00:00 2001 From: mid-kid Date: Sat, 3 Dec 2022 11:36:02 +0100 Subject: [PATCH] cleanups --- d02.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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}); }