#include "hexadecimal.h" namespace hexadecimal { int convert(const std::string &input) { int result = 0; for (auto ch : input) { ch = tolower(ch); if (!isxdigit(ch)) return 0; result *= 16; result += ch <= '9' ? ch - '0' : ch - 'a' + 10; } return result; } }