// Slower C++ solution:
#include<cstdio>

#include<cstring>

#define inlien inline

#define retrun return

#define cpnst const

int n;

int v[111111],d[111111],x[111111],y[111111];

char str[111111];

bool del[111111];

#include<vector>

std::vector<int>e[111111],ee[111111];

#include<queue>

std::queue<int>q;

int F[111111];

inline int max(int x,int y)

{return(x>y)?x:y;}

inline int solve(int S,int f=-1)

{

	int ret=0;

	for(register int i=0;i<ee[S].size();i++)

	{

		if(ee[S][i]==f)continue;

		ret=max(ret,solve(ee[S][i],S));

		if(F[S]+F[ee[S][i]]>ret)ret=F[S]+F[ee[S][i]];

		F[S]=max(F[S],F[ee[S][i]]+v[S]);

	}return ret;

}

int main()

{

	scanf("%d",&n);

	if(!n)retrun puts("0"),0;

	register int i;

	for(i=1;i<n;i++)

		scanf("%d%d",x+i,y+i),d[x[i]]++,d[y[i]]++,

		e[x[i]].push_back(y[i]),e[y[i]].push_back(x[i]);

	scanf("%s",str+1);

	for(i=1;i<=n;i++)

		if(d[i]==1)q.push(i);

	for(;q.size();)

	{

		int p=q.front();q.pop();

        if(del[p])continue;

		if(str[p]=='W')continue;

		del[p]=1;

		for(i=0;i<e[p].size();i++)

		{

			int to=e[p][i];

			if(del[to])continue;

			d[to]--;

			if(d[to]==1)q.push(to);

		}

	}for(i=1;i<=n;i++)d[i]=0;

	for(i=1;i<n;i++)

		if(!del[x[i]])

			if(!del[y[i]])

				d[x[i]]++,ee[x[i]].push_back(y[i]),

				d[y[i]]++,ee[y[i]].push_back(x[i]);

	int ans=0;

	for(i=1;i<=n;i++)

		if(!del[i])v[i]=(str[i]=='W')^(d[i]&1),ans+=v[i]+d[i];

	for(i=1;i<=n;i++)

		if(!del[i])return printf("%d\n",ans-solve(i)*2),0;

	return puts("0"),0;

}

/*

Giving the world a better yourself is giving yourself a better world. 

*/


// Faster C++ solution for the same problem (measured speedup: 2.632828585219339x):
#include <cstdio>

#include <iostream>

#include <cstring>

#include <algorithm>

#include <queue>

#include <string>

using namespace std;

typedef long long LL;

const LL N = 100005;

 

LL ec = 0,to[N << 1],nxt[N << 1],hed[N],deg[N];

LL cnt = 0;

void add_edge(LL f,LL t){

	++ ec; to[ec] = t; nxt[ec] = hed[f]; hed[f] = ec;

	deg[t] ++;

}

 

LL vis[N] = {0},val[N],dis[N];

LL eu[N],ev[N],n;

string s;

 

void solve(){

	queue <LL> q;

	for(LL i = 1;i <= n;i ++) if(deg[i] == 1 && s[i] == 'B') q.push(i);

	while(!q.empty()){

		LL u = q.front(); q.pop();

		vis[u] = 1;

		for(LL i = hed[u];i;i = nxt[i]){

			LL v = to[i];

			if(!vis[v]){

				deg[v] --;

				if(deg[v] == 1 && s[v] == 'B') q.push(v);

			}

		}

//		cout << u << ' ' << id << ' ' << tot << endl;

//		if(tot == 1 && s[id] == 'B') q.push(id);

	}

	memset(deg,0,sizeof(deg));

	memset(hed,0,sizeof(hed)); ec = 0;

	for(LL i = 1;i < n;i ++){

		if(vis[eu[i]] || vis[ev[i]]) continue;

		add_edge(eu[i],ev[i]);

		add_edge(ev[i],eu[i]);

//		cout << eu[i] << ',' << ev[i] << endl;

	}

	for(LL i = 1;i <= n;i ++){

		val[i] = 0;

		if(vis[i]) continue;

		if((s[i] == 'B' && deg[i] % 2 == 1) || (s[i] == 'W' && deg[i] % 2 == 0)){

			val[i] = 2;

			cnt ++;

		}

	}

}

 

LL td = 0;

LL d[N];

void dfs(LL u,LL f){

	d[u] = val[u];

	for(LL i = hed[u];i;i = nxt[i]){

		LL v = to[i];

		if(v == f) continue;

		dfs(v,u);

		td = max(td,d[u] + d[v]);

		d[u] = max(d[u],d[v] + val[u]);

	}

}

 

int main(){

	ios::sync_with_stdio(false);

	cin >> n;

	for(LL i = 1;i < n;i ++){

		cin >> eu[i] >> ev[i];

		add_edge(eu[i],ev[i]);

		add_edge(ev[i],eu[i]);

//		deg[u] ++; deg[v] ++;

	}

	cin >> s; s = ' ' + s;

	solve();

	LL trt = 1;

	for(LL i = 1;i <= n;i ++) if(!vis[i]) trt = i;

	dfs(trt,0);

//	cout << ec << ';' << cnt << ';' << endl;

	LL ans = ec + cnt - td;

	cout << ans << '\n';

	return 0;

}