/*** Longest prefix matching Given a dictionary of words and an input string, find the longest prefix of the string which is also a word in dictionary. Example: Let the dictionary contains the following words: {are, area, base, cat, cater, children, basement} Below are some input/output examples: -------------------------------------- Input String Output -------------------------------------- caterer cater basemexy base child < Empty > ***/ #include <iostream> #include <string> using namespace std; struct node { char val; ...
Comments
Post a Comment