@@ -0,0 +1,1894 @@
+class Node:%0A    def __init__(self):%0A        self.next = %7B%7D%0A        self.word_marker = False %0A%0A%0A    def add(self, string):%0A        %0A        if len(string) == 0:%0A            self.word_marker = True %0A            return %0A        %0A        key = string%5B0%5D %0A        string = string%5B1:%5D %0A%0A        if self.next.has_key(key):%0A            self.next%5Bkey%5D.add(string)%0A        else:%0A            node = Node()%0A            self.next%5Bkey%5D = node%0A            node.add(string)%0A%0A%0A    def partial(self, sf=None):%0A        %0A        if self.next.keys() == %5B%5D:%0A            print %22Match:%22,sf%0A            return%0A            %0A        if self.word_marker == True:%0A            print %22Match:%22,sf%0A%0A        for key in self.next.keys():%0A            self.next%5Bkey%5D.partial(sf+key)%0A%0A    def search(self, string, sf=%22%22):%0A        if len(string) %3E 0:%0A            key = string%5B0%5D%0A            string = string%5B1:%5D%0A            if self.next.has_key(key):%0A                sf = sf + key%0A                self.next%5Bkey%5D.search(string,sf)%0A                %0A            else:%0A                print %22No match%22%0A        else:%0A            if self.word_marker == True:%0A                print %22Match:%22,sf%0A%0A            for key in self.next.keys():%0A                self.next%5Bkey%5D.partial(sf+key)%0A%0A    def exact_match(self, string, sf=''):%0A        if len(string) %3E 0:%0A            key = string%5B0%5D%0A            string = string%5B1:%5D%0A            if self.next.has_key(key):%0A                sf = sf + key%0A                self.next%5Bkey%5D.exact_match(string,sf)%0A                %0A            else:%0A                print %22No match%22%0A        else:%0A            if self.word_marker == True:%0A                print %22Match:%22,sf%0A            elif self.word_marker==False:%0A                print 'No Match.'%0A%0A    def all_trie(self):%0A        a=sorted(self.next.keys())%0A        if(len(a)==0):%0A            print 'Empty Trie.'%0A        for b in a:%0A            self.next%5Bb%5D.partial(b)%0A

Add trie python implementation