✅ One Line Solution
(Disclaimer: this is not an example to follow in a real project - it is written for fun and training mostly)\n\n# Code #1 - Brute Force Counting\npython3\nclass
(Disclaimer: this is not an example to follow in a real project - it is written for fun and training mostly)\n\n# Code #1 - Brute Force Counting\n```python3\nclass Solution:\n    def sumPrefixScores(self, a: List[str]) -> List[int]:\n        return (z:=Counter(s[:i+1] for s in a for i in range(len(s)))) and [sum(z[s[:i+1]] for i in range(len(s))) for s in a]\n```\n\n# Code #2.1 - Bizarre Three Lines Trie Solution\n```python3\nclass Solution:\n    def sumPrefixScores(self, a: List[str]) -> List[int]:\n        d = {}\n        [(p:=d,all((setitem(p.setdefault(c,{0:0}),0,p[c][0]+1),p:=p[c]) for c in s)) for s in a]\n\n        return [(p:=d) and sum((p[c][0],p:=p[c])[0] for c in s) for s in a]\n```\n\n# Code #2.2 - More Bizarre Three Lines Trie Solution\n```python3\nclass Solution:\n    def sumPrefixScores(self, a: List[str]) -> List[int]:\n        d = (f:=lambda:defaultdict(f)|{0:0})()\n        [reduce(lambda p,c:setitem(p[c],0,p[c][0]+1) or p[c],s,d) for s in a]\n\n        return [sum((p[c][0],p:=p[c])[0] for c in s) for s in a if (p:=d)]\n```\n\n(Disclaimer 2: code above is just a product of fantasy packed into one line, it is not claimed to be \'true\' oneliners - please, remind about drawbacks only if you know how to make it better)
['Array', 'String', 'Trie', 'Counting', 'Python', 'Python3']