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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())

#define INF INT_MAX/3
#define mod 1000000007

int n;
vector<int> g[100010];
int deg[100010];
int bcnt[100010],cnt[100010],sum[100010];
int p[100010];
bool dame[100010];
string s;

void predfs(int v,int pre){
  cnt[v]=1;
  if(s[v]=='B')bcnt[v]++;
  for(int nv : g[v]){
    if(nv==pre)continue;
    predfs(nv,v);
    cnt[v]+=cnt[nv];
    bcnt[v]+=bcnt[nv];
  }
  for(int nv : g[v]){
    if(nv==pre)continue;
    if(cnt[nv]==bcnt[nv]){
      dame[nv]=true;
      deg[v]--;
    }
  }
}

void predfs2(int v,int pre){
  if((s[v]=='W'&&deg[v]%2==0)||(s[v]=='B'&&deg[v]%2==1))sum[v]++;
  for(int nv : g[v]){
    if(nv==pre||dame[nv])continue;
    predfs2(nv,v);
    sum[v]+=2;
    sum[v]+=sum[nv];
  }
}


P dfs(int v,int pre){
  P res=P(p[v],v);
  for(int nv : g[v]){
    if(nv==pre||dame[nv])continue;
    P tmp=dfs(nv,v);
    maxch(res,P(tmp.fi+p[v],tmp.se));
  }
  return res;
}

int main(){
  cin>>n;
  rep(i,n-1){
    int a,b;
    cin>>a>>b;
    a--;b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  cin>>s;

  int r=-1,wcnt=0;
  rep(i,n){
    deg[i]=g[i].size();
    if(s[i]=='W'){
      r=i;
      wcnt++;
    }
  }
  if(r==-1){
    cout<<0<<endl;
    return 0;
  }
  if(wcnt==1){
    cout<<1<<endl;
    return 0;
  }
  predfs(r,-1); predfs2(r,-1);
  int res=sum[r];
  rep(i,n){
    if((s[i]=='W'&&deg[i]%2==0)||(s[i]=='B'&&deg[i]%2==1)) p[i]=2;
    else p[i]=0;
  }
  P p1=dfs(r,-1);
  P p2=dfs(p1.se,-1);
  cout<<res-p2.fi<<endl;
  return 0;
}
