diff --git a/2020/day8.cpp b/2020/day8.cpp index ad82b0f..1b389d2 100644 --- a/2020/day8.cpp +++ b/2020/day8.cpp @@ -40,7 +40,7 @@ auto extract_op(const std::string & string) -> Op { else if (string.substr(0, 3) == "jmp") { op.code = Jmp; } else if (string.substr(0, 3) == "nop") { op.code = Nop; } - op.num = std::stoi(string.substr(4, string.size() - 4)); + op.num = std::stoi(string.substr(string.find(" ") + 1, string.size() - 4)); return op; }