#include<bits/stdc++.h>
using namespace std;

int n, rt, fl[101000], col[101000], ans;
vector<int>G[101000], tr[101000];
char s[101000];

void dfs(int x,int fff){
  fl[x]|= s[x]=='W';
  for (auto y:G[x])
    if (y!=fff){
      dfs(y,x);
      if (fl[y]){
	ans+=2; fl[x]|=1;
	tr[x].push_back(y); tr[y].push_back(x);
      }
    }
}

int f[101000][3], res;
void sfd(int x,int fff){
  for (auto y:tr[x])
    if (y!=fff){
      sfd(y,x);
      f[x][2]=f[y][0];
      sort(f[x],f[x]+3,greater<int>());
    }
  f[x][0]+=col[x];
  res=max(res,f[x][0]+f[x][1]);
}

int main(){
  cin>>n; int x, y;
  for (int i=1;i<n;++i){
    cin>>x>>y;
    G[x].push_back(y); G[y].push_back(x);
  }
  cin>>s+1;
  if (*max_element(s+1,s+n+1)=='B') return puts("0"), 0;
  rt=max_element(s+1,s+n+1)-s;
  dfs(rt,0);
  for (int i=1;i<=n;++i)
    if (fl[i]){
      col[i]= (s[i]=='W')^(tr[i].size()&1);
      ans+=col[i];
    }
  sfd(rt,0);
  cerr<<ans<<' '<<res<<endl;
  cout<<max(1,ans-res*2);
}
