#include <bits/stdc++.h>
using namespace std;
const long long N = 2e6 + 7;
vector<long long> adj[N];
long long a[N], sz[N], del[N], f[N], ans[N], dp[N], c;
void dfs(long long u, long long p) {
  sz[u] = 1;
  for (long long v : adj[u])
    if ((v ^ p) && !del[v]) {
      dfs(v, u);
      sz[u] += sz[v];
    }
}
long long find(long long u, long long p, long long s) {
  for (long long v : adj[u]) {
    if ((v ^ p) && !del[v] && sz[v] * 2 >= s) {
      return find(v, u, s);
    }
  }
  return u;
}
void add(long long u, long long p, long long mask, long long val) {
  mask ^= a[u];
  f[mask] += val;
  for (long long v : adj[u])
    if ((v ^ p) && !del[v]) {
      add(v, u, mask, val);
    }
}
long long DFS(long long u, long long p, long long mask) {
  dp[u] = 0;
  mask ^= a[u];
  long long res = 0;
  for (long long v : adj[u])
    if ((v ^ p) && !del[v]) {
      res += DFS(v, u, mask);
      dp[u] += dp[v];
    }
  dp[u] += f[mask];
  for (long long i = 0; i < 20; i++) {
    dp[u] += f[mask ^ (1 << i)];
  }
  if (__builtin_popcountll(mask) <= 1) res++;
  ans[u] += dp[u] + res;
  return res;
}
void decompose(long long u) {
  dfs(u, -1);
  c = find(u, -1, sz[u]);
  for (long long v : adj[c])
    if (!del[v]) {
      add(v, c, 0, +1);
    }
  ans[c] += f[0];
  for (long long i = 0; i < 20; i++) {
    ans[c] += f[(1 << i) | a[c]];
  }
  long long x = 0;
  for (long long v : adj[c])
    if (!del[v]) {
      add(v, c, 0, -1);
      DFS(v, c, a[c]);
      add(v, c, 0, +1);
      x += dp[v];
    }
  for (long long v : adj[c])
    if (!del[v]) {
      add(v, c, 0, -1);
    }
  ans[c] += (x / 2) + 1;
  del[c] = 1;
  for (long long v : adj[c])
    if (!del[v]) {
      decompose(v);
    }
}
int32_t main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  for (long long i = 1; i < n; i++) {
    long long u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  string str;
  cin >> str;
  for (long long i = 0; i < n; i++) {
    a[i + 1] = 1 << (str[i] - 'a');
  }
  decompose(1);
  for (long long i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
}
