需要写一个函数word_tree(),能执行以下操作
s = "spam eggs spam eggs ham spam hamham Spam"
t = Node('spam', 3, Node('eggs', 2, Node('Spam', 1, None,
None), Node('ham', 1, None, Node('hamham', 1,
None, None))), None)
str(word_tree(s)) == str(t)
True
需要写一个函数word_tree(),能执行以下操作
s = "spam eggs spam eggs ham spam hamham Spam"
t = Node('spam', 3, Node('eggs', 2, Node('Spam', 1, None,
None), Node('ham', 1, None, Node('hamham', 1,
None, None))), None)
str(word_tree(s)) == str(t)
True