func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, res[300010], c[300010], trie[300010][30], dif[300010], ans, cans;   vector<vector<int> > gr;   string s;   void merge(int big, int small) {     dif[big] = 1;     for (int i = 0; i < 26; ++i) {       if (trie[small][i] and trie[big][i]) {         merge(trie[big][i], trie[small][i]);       } else if (trie[small][i] and trie[big][i] == 0) {         trie[big][i] = trie[small][i];       }       dif[big] += dif[trie[big][i]];     }   }   void dfs(int x, int par) {     dif[x] = 1;     for (auto i : gr[x]) {       if (i == par) {         continue;       }       dfs(i, x);       int xCh = trie[x][s[i - 1] -  a ];       if (!xCh) {         trie[x][s[i - 1] -  a ] = i;         dif[x] += dif[i];       } else {         dif[x] -= dif[xCh];         merge(xCh, i);         dif[x] += dif[xCh];       }     }     res[x] = dif[x] + c[x];   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     cin >> n;     gr.resize(n + 1, vector<int>());     for (int i = 1; i <= n; ++i) {       cin >> c[i];     }     cin >> s;     for (int i = 0; i < n - 1; ++i) {       int u, v;       cin >> u >> v;       gr[u].push_back(v);       gr[v].push_back(u);     }     dfs(1, -1);     for (int i = 1; i <= n; ++i) {       ans = max(ans, res[i]);     }     for (int i = 1; i <= n; ++i) {       if (res[i] == ans) {         ++cans;       }     }     cout << ans <<   n ;     cout << cans;   }   