#include "trie.h" #include #include int main() { Trie trie { }; std::ifstream ifs { "digits.txt" }; std::string digits { }; while (ifs >> digits) trie.insert(digits); while (true) { std::cout << "> "; if (not (std::cin >> digits)) break; if (digits == "exit") break; if (trie.contains(digits)) std::cout << "Exists!" << std::endl; else std::cout << "Doesn't exist." << std::endl; std::vector all { trie.all_with_prefix(digits) }; std::cout << "Is a prefix of:" << std::endl; for (std::string const& digits : all) std::cout << "\t" << digits << std::endl; } }