タブ区切りで表示 >>> l = ['a', 'b', 'c', 'd', 'e'] >>> print('\t'.join([str(i) for i in l])) a b c d e スペース区切りで表示 >>> l = ['a', 'b', 'c', 'd', 'e'] >>> print(' '.join([str(i) for i in l])) a b c d e コンマ区切りで表示 >>> l = ['a',
import collections class TriNode(object): def __init__(self): self.children = collections.defaultdict(TriNode) self.is_word = False class TriTree: def __init__(self): self.root = TriNode() def insert(self, word): current = self.root for letter in word: current = current.children[letter] current.is_word = True def search(self, word): current = self.root for letter in word: current = current.children[letter] if current is None: return False return current.is_word def startswith(self, prefix): current = self.root for letter in prefix: current = current.children[letter] if