#include <bits/stdc++.h>
using namespace std;
const int mod = (1e9) + 7;
const int siz = 2e5 + 5, siz2 = 105e4 + 5;
int n, curver, centroid, curver2, mn, last,
    lim = 1 << 19, treesz[siz], ver[siz2], verof[siz2], dfsnodes[siz],
    dfsmasks[siz], parent[siz], mask[siz2], maskof[siz2];
vector<int> adj[siz];
char arr[siz];
bool done[siz], valid[siz2];
long long ans[siz], curans[siz], centans;
void calcsz(int node, int par) {
  treesz[node] = 1;
  int sz = adj[node].size(), mx = INT_MIN;
  for (int i = 0; i < sz; i++) {
    int nex = adj[node][i];
    if (!done[nex] && nex != par) {
      calcsz(nex, node);
      treesz[node] += treesz[nex];
    }
  }
}
void getcentroid(int node, int par, int tot) {
  while (true) {
    int mx = tot - treesz[node], mxnode = node;
    int sz = adj[node].size();
    for (int i = 0; i < sz; i++) {
      int nex = adj[node][i];
      if (!done[nex] && nex != par) {
        if (treesz[nex] > mx) {
          mx = treesz[nex];
          mxnode = nex;
        }
      }
    }
    if (mx < mn) {
      mn = mx;
      centroid = node;
    }
    if (node == mxnode) return;
    par = node;
    node = mxnode;
  }
}
bool check(int mask) {
  bool one = false;
  while (mask != 0) {
    if (mask % 2) {
      if (one) return false;
      one = true;
    }
    mask >>= 1;
  }
  return true;
}
void calcmask(int node, int par, int parmask) {
  int curmask = (1 << (arr[node] - 97)) ^ parmask;
  dfsnodes[last] = node;
  dfsmasks[last++] = curmask ^ (1 << (arr[centroid] - 97));
  parent[node] = par;
  if (valid[curmask]) {
    curans[node]++;
    ans[centroid]++;
  }
  if (ver[curmask] == curver) {
    mask[curmask]++;
  } else {
    ver[curmask] = curver;
    mask[curmask] = 1;
  }
  int sz = adj[node].size();
  for (int i = 0; i < sz; i++) {
    int nex = adj[node][i];
    if (!done[nex] && nex != par) {
      calcmask(nex, node, curmask);
    }
  }
}
void calcmaskof(int l, int r) {
  int centmask = (1 << (arr[centroid] - 97));
  for (int i = l; i <= r; i++) {
    int wcent = dfsmasks[i] ^ centmask;
    if (curver2 == verof[wcent])
      maskof[wcent]++;
    else {
      verof[wcent] = curver2;
      maskof[wcent] = 1;
    }
  }
}
void calcans(int r, int l) {
  for (int i = r; i >= l; i--) {
    int node = dfsnodes[i], wocent = dfsmasks[i];
    if (ver[wocent] == curver) {
      long long v =
          mask[wocent] - (verof[wocent] == curver2 ? maskof[wocent] : 0);
      centans += v;
      curans[node] += v;
    }
    for (int i = 1; i <= lim; i <<= 1) {
      int val = wocent ^ i;
      if (ver[val] == curver) {
        long long v = mask[val] - (verof[val] == curver2 ? maskof[val] : 0);
        centans += v;
        curans[node] += v;
      }
    }
    if (parent[node] != centroid) curans[parent[node]] += curans[node];
    ans[node] += curans[node];
    curans[node] = 0;
  }
}
void solve(int start) {
  stack<int> st;
  st.push(start);
  while (!st.empty()) {
    int cur = st.top();
    st.pop();
    calcsz(cur, 0);
    if (treesz[cur] == 1) {
      ans[cur]++;
      done[cur] = true;
      continue;
    }
    mn = INT_MAX;
    getcentroid(cur, 0, treesz[cur]);
    curver++;
    ans[centroid]++;
    int centmask = (1 << (arr[centroid] - 97));
    vector<pair<int, int>> ends;
    int sz = adj[centroid].size();
    for (int i = 0; i < sz; i++) {
      int node = adj[centroid][i];
      if (!done[node]) {
        calcmask(node, centroid, centmask);
        int sz = ends.size();
        ends.push_back({sz ? ends[sz - 1].second + 1 : 0, last - 1});
      }
    }
    for (int i = ends.size() - 1; i >= 0; i--) {
      curver2++;
      int l = ends[i].first, r = ends[i].second;
      calcmaskof(l, r);
      calcans(r, l);
    }
    ans[centroid] += centans / 2;
    centans = 0;
    last = 0;
    done[centroid] = true;
    for (int i = 0; i < sz; i++) {
      int node = adj[centroid][i];
      if (!done[node]) {
        st.push(node);
      }
    }
  }
}
void pre() {
  valid[0] = true;
  for (int i = 1; i <= lim; i <<= 1) valid[i] = true;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  scanf("%s", arr + 1);
  pre();
  solve(1);
  for (int i = 1; i <= n; i++) {
    printf("%I64d", ans[i]);
    if (i != n)
      printf(" ");
    else
      printf("\n");
  }
  return 0;
}
