/* --- author: dxm --- */
#include<bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;

#define INF 1e9
#define Inf 1e18
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mp make_pair
#define pb push_back
#define fst first
#define snd second
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

void qread(int &x){
	int neg=1;x=0;
	char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')neg=-1;c=getchar();}
	while(c>='0'&&c<='9')x=10*x+c-'0',c=getchar();
	x*=neg;
}

const int maxn=100005;
int n,rt,m,cnt;
int a[maxn],dp[maxn][2],dp2[maxn],d[maxn];
bool exi[maxn];
vector<int>edge[maxn];
char c[maxn];

void dfs1(int x,int p){
	if(c[x]=='W')exi[x]=true;
	rep(i,edge[x].size()){
		int y=edge[x][i];
		if(y==p)continue;
		dfs1(y,x);
		exi[x]|=exi[y];
		if(exi[y])d[x]++;
	}
	if(!exi[x])m--;
} 

void dfs2(int x,int p){
	dp[x][0]=-INF;
	dp[x][1]=dp2[x]=1+a[x];
	bool leaf=true;
	rep(i,edge[x].size()){
		int y=edge[x][i];
		if(y==p||!exi[y])continue;
		leaf=false;
		dfs2(y,x);
		dp2[x]=max(dp2[x],dp2[y]);
		dp2[x]=max(dp2[x],dp[x][0]+dp[y][1]);
		dp2[x]=max(dp2[x],dp[x][1]+max(dp[y][0],dp[y][1]));
		dp[x][0]=max(dp[x][0],dp[y][0]+a[x]+1);
		dp[x][1]=max(dp[x][1],dp[y][1]+a[x]+1);
	}
	if(leaf)dp[x][0]=1+a[x],dp[x][1]=-INF;
	dp2[x]=max(dp2[x],max(dp[x][0],dp[x][1]));
}

int main(){
#ifdef FILE
	freopen("FILE.in","r",stdin);
	freopen("FILE.out","w",stdout);
#endif
	scanf("%d",&n);
	m=n;
	REP(i,n-1){
		int u,v;
		scanf("%d%d",&u,&v);
		edge[u].pb(v);
		edge[v].pb(u);
	}
	scanf("%s",c+1);
	REP(i,n)if(c[i]=='W')cnt++,rt=i;
	if(!cnt){
		puts("0");
		return 0;
	}
	if(cnt==1){
		puts("1");
		return 0;
	}
	dfs1(rt,0);
	int ans=(m-1)*2;
	REP(i,n)if(exi[i]){
		a[i]=(c[i]=='W')^((d[i]+(i!=rt))&1);
		ans+=a[i];
		if(!a[i])a[i]=-1;
	}
	dfs2(rt,0);
	printf("%d\n",ans-dp2[rt]);
#ifdef TIME
	printf("Running Time = %d ms\n",int(clock()*1000.0/CLOCKS_PER_SEC));
#endif
	return 0;
}

/*
Input:
-----------------
Output:
*/
