Python 3 solution - clean use of trie data structure and hash map soluton.
Code\npython [Prefix Trie]\nclass TrieNode:\n    def __init__(self):\n        self.children = {}\n        self.count = 0\n\nclass Trie:\n    def __init__(self):
# Code\n```python [Prefix Trie]\nclass TrieNode:\n    def __init__(self):\n        self.children = {}\n        self.count = 0\n\nclass Trie:\n    def __init__(self):\n        self.root = TrieNode()\n    \n    def insert(self, words: List[str]) -> None:\n        for word in words:\n            current = self.root\n            for letter in word:\n                if letter not in current.children:\n                    current.children[letter] = TrieNode()\n                current = current.children[letter]\n                current.count += 1\n    \n    def sum_prefix(self, word: str) -> int:\n        current = self.root\n        count = 0\n        for letter in word:   \n            current = current.children[letter]\n            count += current.count\n        return count\n\nclass Solution:\n    def sumPrefixScores(self, words: List[str]) -> List[int]:\n        prefix_trie = Trie()\n        prefix_trie.insert(words)      \n        return [prefix_trie.sum_prefix(word) for word in words]\n        \n```\n```python [Hash map]\nclass Solution:\n    def sumPrefixScores(self, words: List[str]) -> List[int]:\n        hash_map = defaultdict(int)\n        for word in words:\n            for i in range(1, len(word) + 1):\n                hash_map[word[:i]] += 1\n        result = []\n        for word in words:\n            result.append(0)\n            for i in range(1, len(word) + 1):\n                result[-1] += hash_map[word[:i]]\n        return result\n\n```
['Python3']