#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e6 + 123;
const long long INF = (long long)1e18 + 123;
const int inf = (int)1e9 + 123;
const int MOD = (int)1e9 + 7;
void megaRandom() {
  unsigned int FOR;
  asm("rdtsc" : "=A"(FOR));
  srand(FOR);
}
int n;
vector<int> g[N];
char ch[N];
bool deleted[N];
int sub[N];
void dfs(int x, int pr = 0) {
  sub[x] = 1;
  for (auto to : g[x]) {
    if (to == pr || deleted[to]) continue;
    dfs(to, x);
    sub[x] += sub[to];
  }
}
int centroid(int x) {
  int v = x, pr = 0;
  while (1) {
    bool changed = 0;
    for (auto to : g[v]) {
      if (to == pr || deleted[to]) continue;
      if (sub[to] * 2 >= sub[x]) {
        pr = v, v = to, changed = 1;
        break;
      }
    }
    if (!changed) break;
  }
  return v;
}
int cnt[(int)1e7];
void kfc(int x, int pr, int cur_mask, int what) {
  cur_mask ^= (1 << ch[x] - 'a');
  cnt[cur_mask] += what;
  for (auto to : g[x]) {
    if (deleted[to] || to == pr) continue;
    kfc(to, x, cur_mask, what);
  }
}
long long add[N], ans[N], rem[N];
void naruto(int x, int pr, int cur_mask, char rt, int root) {
  cur_mask ^= (1 << ch[x] - 'a');
  for (int i = 0; i < 20; i++) {
    add[x] += cnt[(cur_mask ^ (1 << i) ^ (1 << rt - 'a'))];
  }
  add[x] += cnt[(cur_mask ^ (1 << rt - 'a'))];
  if (__builtin_popcount(cur_mask ^ (1 << rt - 'a')) <= 1)
    add[x]++, rem[root]++;
  for (auto to : g[x]) {
    if (deleted[to] || to == pr) continue;
    naruto(to, x, cur_mask, rt, root);
  }
  add[pr] += add[x];
  ans[x] += add[x];
  add[x] = 0;
}
void go(int x, int pr = 0) {
  dfs(x);
  x = centroid(x);
  for (auto to : g[x]) {
    if (deleted[to]) continue;
    kfc(to, x, 0, 1);
  }
  for (auto to : g[x]) {
    if (deleted[to]) continue;
    kfc(to, x, 0, -1);
    naruto(to, x, 0, ch[x], x);
    kfc(to, x, 0, 1);
  }
  for (auto to : g[x]) {
    if (deleted[to]) continue;
    kfc(to, x, 0, -1);
  }
  ans[x] += (add[x] - rem[x]) / 2 + rem[x];
  add[x] = 0;
  rem[x] = 0;
  deleted[x] = 1;
  for (auto to : g[x]) {
    if (deleted[to]) continue;
    go(to, x);
  }
}
int main() {
  megaRandom();
  scanf("%d", &n);
  for (int i = 1, x, y; i < n; i++) {
    scanf("%d%d", &x, &y);
    g[x].push_back(y), g[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) scanf(" %c", &ch[i]);
  go(1);
  for (int i = 1; i <= n; i++) printf("%I64d ", ans[i] + 1);
  return 0;
}
