#NEWLINE# def insert( self , word ) : #NEWLINE# #INDENT# '\n        Inserts a word into the trie.\n        :type word: str\n        :rtype: None\n        ' #NEWLINE# cur = self . root #NEWLINE# for w in word : #NEWLINE# #INDENT# if ( w not in cur . children ) : #NEWLINE# #INDENT# cur . children [ w ] = TrieNode ( ) #NEWLINE# #UNINDENT# cur = cur . children [ w ] #NEWLINE# #UNINDENT# cur . ended = True