A disk stores hierarchical data as an undirected tree with treeNodes nodes numbered from 0 to treeNodes - 1, rooted at node 0.
You are given a string s of length treeNodes, where s[i] is the lowercase character stored at node i.
The tree is described by two arrays treeFrom and treeTo, each of length treeNodes - 1, where treeFrom[i] and treeTo[i] are the endpoints of the ith undirected edge.
You are also given an array queries. For each query node q, count how many nodes v on the path from q to the root (including q itself) have the property that the characters on the path from q to v can be rearranged into a palindrome.
Return an array answer where answer[i] is the result for queries[i].
A multiset of characters can be rearranged into a palindrome if and only if at most one character has an odd frequency.
For query node 3, the valid ancestors are 3, 1, and 0 because the path strings are "a", "aa", and "aza".
For 3, only "c" works. For 4, both "a" and "aba" work. For 2, both "a" and "aa" work. The root query always contributes at least itself.