#include <iostream>
#include <stdexcept>
#include <string>
#include <vector>

std::vector<uint8_t> convert(const std::string& s)
{
    if (s.size() % 2 != 0) {
        throw std::runtime_error("Bad size argument");
    }
    std::vector<uint8_t> res;
    res.reserve(s.size() / 2);
    for (std::size_t i = 0, size = s.size(); i != size; i += 2) {
        std::size_t pos = 0;
        res.push_back(std::stoi(s.substr(i, 2), &pos, 16));
        if (pos != 2) {
            throw std::runtime_error("bad character in argument");
        }
    }
    return res;
}

int main()
{
    const char* starting = "001122AABBCC";
    std::vector<uint8_t> ending = {0x00, 0x11, 0x22, 0xAA, 0xBB, 0xCC};

    std::cout << (ending == convert(starting)) << std::endl;

    return 0;
}
