#include <bits/stdc++.h>
using namespace std;
const int maxn = 200500;
const int M = 1148576;
const int inf = 1e9;
struct edge {
  int obj, pre;
} e[maxn * 2];
int head[maxn], vis[maxn], a[maxn], sz[maxn], flag[M], cnt[M];
long long sum[maxn], ans[maxn];
char ch[maxn];
int n, szn, rt, mn, tot, idx;
void insert(int x, int y) {
  e[++tot].obj = y;
  e[tot].pre = head[x];
  head[x] = tot;
}
void getsz(int u, int fa) {
  sz[u] = 1;
  sum[u] = 0;
  for (int j = head[u]; j; j = e[j].pre) {
    int v = e[j].obj;
    if (vis[v] || v == fa) continue;
    getsz(v, u);
    sz[u] += sz[v];
  }
}
void getrt(int u, int fa) {
  int mx = szn - sz[u];
  for (int j = head[u]; j; j = e[j].pre) {
    int v = e[j].obj;
    if (v == fa || vis[v]) continue;
    mx = max(mx, sz[v]);
    getrt(v, u);
  }
  if (mx < mn) mn = mx, rt = u;
}
void add(int x, int y) {
  if (flag[x] != idx) cnt[x] = 0, flag[x] = idx;
  cnt[x] += y;
}
int find(int x) {
  if (flag[x] != idx) cnt[x] = 0, flag[x] = idx;
  return cnt[x];
}
int query(int x) {
  int ans = find(x);
  for (int i = 0; i <= 19; i++) ans += find(x ^ (1 << i));
  return ans;
}
void getval(int u, int fa, int x) {
  add(x, 1);
  for (int j = head[u]; j; j = e[j].pre) {
    int v = e[j].obj;
    if (vis[v] || v == fa) continue;
    getval(v, u, x ^ a[v]);
  }
}
void getans(int u, int fa, int x, int op) {
  sum[u] += query(x) * op;
  for (int j = head[u]; j; j = e[j].pre) {
    int v = e[j].obj;
    if (v == fa || vis[v]) continue;
    getans(v, u, x ^ a[v], op);
  }
}
void getpre(int u, int fa) {
  for (int j = head[u]; j; j = e[j].pre) {
    int v = e[j].obj;
    if (vis[v] || v == fa) continue;
    getpre(v, u);
    sum[u] += sum[v];
  }
  if (!fa) sum[u] = (sum[u] + 1) / 2;
  ans[u] += sum[u];
}
void solve(int u) {
  getsz(u, 0);
  szn = sz[u];
  mn = inf;
  rt = 0;
  getrt(u, 0);
  int k = rt;
  vis[k] = 1;
  idx++;
  add(0, 1);
  for (int j = head[k]; j; j = e[j].pre) {
    int v = e[j].obj;
    if (vis[v]) continue;
    getval(v, k, a[v]);
  }
  sum[k] += query(a[k]);
  for (int j = head[k]; j; j = e[j].pre) {
    int v = e[j].obj;
    if (vis[v]) continue;
    getans(v, k, a[v] ^ a[k], 1);
  }
  for (int j = head[k]; j; j = e[j].pre) {
    int v = e[j].obj;
    if (vis[v]) continue;
    ++idx;
    getval(v, k, a[v]);
    getans(v, k, a[v] ^ a[k], -1);
  }
  getpre(k, 0);
  for (int j = head[k]; j; j = e[j].pre) {
    int v = e[j].obj;
    if (!vis[v]) solve(v);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    insert(x, y);
    insert(y, x);
  }
  scanf("%s", ch + 1);
  for (int i = 1; i <= n; i++) a[i] = 1 << (ch[i] - 'a');
  szn = n;
  solve(1);
  for (int i = 1; i <= n; i++) printf("%lld ", ans[i]);
  return 0;
}
