%language=C++ %includes %constexpr %% monday tuesday wednesday thursday friday saturday sunday %% #include #include constexpr int foo(const char* s) { const char* x = Perfect_Hash::in_word_set(s, strlen(s)); if(x != 0) return Perfect_Hash::hash(s, strlen(s)); return MAX_HASH_VALUE + 1; } int main(int argc, char** argv) { std::string input; std::cout << "Enter a day-of-week: "; std::cin >> input; switch(foo(input.c_str())) { case foo("monday"): case foo("tuesday"): case foo("wednesday"): case foo("thursday"): case foo("friday"): std::cout << "Workday :-(" << std::endl; break; case foo("saturday"): case foo("sunday"): std::cout << "Weekend :-)" << std::endl; break; default: std::cout << "Not a day-of-week" << std::endl; return 1; } return 0; }