#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
unordered_set<int> g[N];
int sub[N], cnt[1 << 20], a[N];
int nn, single;
string s;
long long ans[N], c[N];
void dfs(int u, int p) {
  sub[u] = 1;
  nn++;
  for (auto v : g[u]) {
    if (v != p) dfs(v, u), sub[u] += sub[v];
  }
}
int dfs1(int u, int p) {
  for (auto v : g[u]) {
    if (v != p && sub[v] > nn / 2) return dfs1(v, u);
  }
  return u;
}
void add(int u, int p, int val, int x) {
  cnt[val] += x;
  for (auto v : g[u]) {
    if (v != p) add(v, u, val ^ a[v], x);
  }
}
void query(int u, int p, int val) {
  c[u] = cnt[val];
  if (val == 0 or ((val & (val - 1)) == 0)) single++;
  for (int i = 0; i < 20; i++) c[u] += cnt[val ^ (1 << i)];
  for (auto v : g[u]) {
    if (v != p) {
      query(v, u, val ^ a[v]);
      c[u] += c[v];
    }
  }
  ans[u] += c[u];
}
void decompose(int root) {
  nn = 0;
  dfs(root, root);
  int centroid = dfs1(root, root);
  add(centroid, -1, 0, 1);
  ans[centroid]++;
  long long ct = 0;
  for (auto v : g[centroid]) {
    add(v, centroid, a[v], -1);
    query(v, centroid, a[v] ^ a[centroid]);
    add(v, centroid, a[v], 1);
    ct += c[v];
  }
  ans[centroid] += (ct + single) / 2;
  single = 0;
  add(centroid, -1, 0, -1);
  for (auto v : g[centroid]) {
    g[v].erase(centroid);
    decompose(v);
  }
  g[centroid].clear();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    g[u - 1].insert(v - 1);
    g[v - 1].insert(u - 1);
  }
  cin >> s;
  for (int i = 0; i < n; i++) a[i] = (1 << (s[i] - 'a'));
  decompose(0);
  for (int i = 0; i < n; i++) cout << ans[i] << " ";
  cout << "\n";
}
