#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"-----------------"#x"-----------------\n"
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
                    For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int,int> pii;
LL read(){
    LL x=0,f=0;
    char ch=getchar();
    while (!isdigit(ch))
        f=ch=='-',ch=getchar();
    while (isdigit(ch))
        x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
    return f?-x:x;
}
const int N=100005;
int n;
int a[N];
set <int> e[N];
int del[N];
queue <int> Q;
void Get_color(){
	static char s[N];
	cin>>(s+1);
	For(i,1,n)
		a[i]=s[i]=='W';
}
int check(){
	For(i,1,n)
		if (a[i])
			return 0;
	return 1;
}
int milen=0;
int dfs(int x,int pre){
	int mi=a[x]?-2:0;
	for (auto y : e[x])
		if (y!=pre){
			int tmp=dfs(y,x);
			milen=min(milen,mi+tmp);
			mi=min(mi,tmp+(a[x]?-2:0));
		}
	milen=min(milen,mi);
	return mi;
}
int main(){
	n=read();
	For(i,1,n-1){
		int x=read(),y=read();
		e[x].insert(y),e[y].insert(x);
	}
	Get_color();
	if (check())
		return puts("0"),0;
	For(i,1,n)
		if (e[i].size()==1)
			Q.push(i);
	int ans=n;
	while (!Q.empty()){
		int x=Q.front();
		Q.pop();
		if (a[x])
			continue;
		del[x]=1;
		ans--;
		int y=*e[x].begin();
		e[x].erase(y),e[y].erase(x);
		if (e[y].size()==1)
			Q.push(y);
	}
	ans*=2;
	ans-=2;
	int rt=0;
	For(i,1,n)
		if (!del[i]){
			rt=i;
			break;
		}
	For(i,1,n)
		a[i]^=e[i].size()&1;
	For(i,1,n)
		ans+=a[i];
	dfs(rt,0);
	cout<<max(ans+milen,1)<<endl;
	return 0;
}