#include <bits/stdc++.h>
using namespace std;
const int N = 2e5;
vector<int> g[N];
bool used[N];
int sz[N];
int a[N];
long long ans[N];
void dfs2(int u, int p) {
  sz[u] = 1;
  for (int v : g[u])
    if (v != p && !used[v]) {
      dfs2(v, u);
      sz[u] += sz[v];
    }
}
int dfs3(int u, int p, int x) {
  for (int v : g[u])
    if (v != p && !used[v]) {
      if (sz[v] > x / 2) {
        return dfs3(v, u, x);
      }
    }
  return u;
}
long long mp[1 << 20];
void dfs4(int u, int p, int val) {
  val ^= a[u];
  mp[val]++;
  for (int v : g[u])
    if (v != p && !used[v]) {
      dfs4(v, u, val);
    }
}
void dfs5(int u, int p, int val) {
  val ^= a[u];
  mp[val]--;
  for (int v : g[u])
    if (v != p && !used[v]) {
      dfs5(v, u, val);
    }
}
long long dfs6(int u, int p, int val) {
  val ^= a[u];
  long long cnt = mp[val];
  for (int i = 0; i < 20; i++) {
    cnt += mp[(1 << i) ^ val];
  }
  for (int v : g[u])
    if (v != p && !used[v]) {
      cnt += dfs6(v, u, val);
    }
  ans[u] += cnt;
  return cnt;
}
void dfs(int u) {
  dfs2(u, -1);
  u = dfs3(u, -1, sz[u]);
  dfs4(u, -1, 0);
  used[u] = true;
  long long cen = mp[0];
  for (int i = 0; i < 20; i++) {
    cen += mp[1 << i];
  }
  for (int v : g[u])
    if (!used[v]) {
      dfs5(v, u, a[u]);
      cen += dfs6(v, u, 0);
      dfs4(v, u, a[u]);
    }
  cen /= 2;
  ans[u] += cen;
  dfs5(u, -1, 0);
  for (int v : g[u])
    if (!used[v]) {
      dfs(v);
    }
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--;
    v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  string s;
  cin >> s;
  for (int i = 0; i < n; i++) {
    a[i] = 1 << (s[i] - 'a');
  }
  dfs(0);
  for (int i = 0; i < n; i++) {
    printf("%lld ", ans[i] + 1);
  }
}
