#include <bits/stdc++.h>   using namespace std;   vector<int> g[200005];   int par[19][200005];   int depth[200005];   int dp[200005];   char s[200005];   void dfs(int u, int p, int d, int val) {     par[0][u] = p;     depth[u] = d;     dp[u] = val ^ (1 << (s[u] -  a ));     for (int i = 0; i < g[u].size(); i++) {       int v = g[u][i];       if (v == p) continue;       dfs(v, u, d + 1, dp[u]);     }   }   int LCA(int a, int b) {     if (depth[a] < depth[b]) swap(a, b);     int diff = depth[a] - depth[b];     for (int i = 18; i >= 0; i--) {       if ((diff >> i) & 1) a = par[i][a];     }     if (a == b) return a;     for (int i = 18; i >= 0; i--) {       if (par[i][a] != par[i][b]) a = par[i][a], b = par[i][b];     }     return par[0][a];   }   int dist(int a, int b) { return dp[a] ^ dp[b] ^ (1 << (s[LCA(a, b)] -  a )); }   int nn = 0;   int sub[200005];   bool vis[200005];   vector<pair<int, int> > edge[200005];   long long cnt[2000005];   long long ans[200005], add[200005];   void dfs1(int u, int p) {     sub[u] = 1;     nn++;     for (int i = 0; i < g[u].size(); i++) {       int v = g[u][i];       if (v == p || vis[v]) continue;       dfs1(v, u);       sub[u] += sub[v];     }   }   int dfs2(int u, int p) {     for (int i = 0; i < g[u].size(); i++) {       int v = g[u][i];       if (v == p || vis[v]) continue;       if (sub[v] > nn / 2) return dfs2(v, u);     }     return u;   }   void dfs3(int u, int p, int r, int idx) {     int bits = dist(u, r);     edge[idx].push_back(pair<int, int>(bits, u));     cnt[bits]++;     for (int i = 0; i < g[u].size(); i++) {       int v = g[u][i];       if (v == p || vis[v]) continue;       dfs3(v, u, r, idx);     }   }   void dfs4(int u, int p) {     for (int i = 0; i < g[u].size(); i++) {       int v = g[u][i];       if (v == p || vis[v]) continue;       dfs4(v, u);       add[u] += add[v];       add[v] = 0;     }     ans[u] += add[u];   }   void decompose(int u, int p) {     nn = 0;     dfs1(u, u);     int centroid = dfs2(u, u);     vis[centroid] = 1;     for (int i = 0; i < g[centroid].size(); i++) {       int v = g[centroid][i];       if (v == p || vis[v]) continue;       edge[i].clear();       dfs3(v, centroid, centroid, i);     }     for (int i = 0; i < g[centroid].size(); i++) {       int v = g[centroid][i];       if (v == p || vis[v]) continue;       for (int j = 0; j < edge[i].size(); j++) cnt[edge[i][j].first]--;       for (int j = 0; j < edge[i].size(); j++) {         int bits = edge[i][j].first;         int cur = edge[i][j].second;         int tot = __builtin_popcount(bits);         if (tot <= 1) add[centroid]++, add[cur]++;         add[cur] += cnt[bits ^ (1 << (s[centroid] -  a ))];         for (int j = 0; j < 20; j++) {           add[cur] += cnt[bits ^ (1 << j) ^ (1 << (s[centroid] -  a ))];         }       }       for (int j = 0; j < edge[i].size(); j++) cnt[edge[i][j].first]++;     }     for (int i = 0; i < g[centroid].size(); i++) {       int v = g[centroid][i];       if (v == p || vis[v]) continue;       for (int j = 0; j < edge[i].size(); j++) cnt[edge[i][j].first] = 0;     }     for (int i = 0; i < g[centroid].size(); i++) {       int v = g[centroid][i];       if (v == p || vis[v]) continue;       dfs4(v, centroid);       add[centroid] += add[v];       add[v] = 0;     }     ans[centroid] += add[centroid] / 2;     add[centroid] = 0;     for (int i = 0; i < g[centroid].size(); i++) {       int v = g[centroid][i];       if (v == p || vis[v]) continue;       decompose(v, centroid);     }   }   int main() {     int n;     scanf( %d , &n);     for (int i = 0; i < n - 1; i++) {       int a, b;       scanf( %d%d , &a, &b);       g[a].push_back(b);       g[b].push_back(a);     }     scanf( %s , s + 1);     dfs(1, 0, 0, 0);     for (int j = 1; j <= 18; j++) {       for (int i = 1; i <= n; i++) {         if (par[j - 1][i] != 0) par[j][i] = par[j - 1][par[j - 1][i]];       }     }     decompose(1, 0);     for (int i = 1; i <= n; i++) printf( %lld  , ans[i] + 1);   }