#include<bits/stdc++.h>
#define ll long long
#define dbg1(x) cerr<<#x<<"="<<(x)<<" "
#define dbg2(x) cerr<<#x<<"="<<(x)<<"\n"
#define dbg3(x) cerr<<#x<<"\n"
using namespace std;
#define reg register
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
	return x*f;
}
const int MN=1e5+5,inf=0x7fffffff;
int N;
bool c[MN];
struct edge{int to,nex;}e[MN<<1];
int en,hr[MN];
void ins(int x,int y)
{
	e[++en]=(edge){y,hr[x]};hr[x]=en;
	e[++en]=(edge){x,hr[y]};hr[y]=en;
}
int sw[MN],fa[MN],rt,sW;
void dfs1(int x,int f=0)
{
	reg int i;sw[x]=c[x];fa[x]=f;
	for(i=hr[x];i;i=e[i].nex)if(e[i].to^f)dfs1(e[i].to,x),sw[x]+=sw[e[i].to];
	if(sw[x]==sW&&!rt)rt=x;
}
int ans,son[MN],deg[MN];
void dfs2(int x)
{
	if(!sw[x])return;++son[fa[x]];if(x!=rt)ans+=2;
	for(int i=hr[x];i;i=e[i].nex)if(e[i].to^fa[x])dfs2(e[i].to);
	ans+=(deg[x]=son[x]+c[x]+(x!=rt))&1;deg[x]=deg[x]&1?1:-1;
}
int dp[MN][2];
#define fi first
#define se second
void dfs3(int x)
{
	reg int i;
	if(!sw[x])return;pair<int,int> p;p.fi=p.se=0;
	for(i=hr[x];i;i=e[i].nex)if(e[i].to!=fa[x]&&sw[e[i].to])
	{
		dfs3(e[i].to);
		dp[x][0]=max(dp[x][0],dp[e[i].to][0]);
		dp[x][1]=max(dp[x][1],deg[x]+1+dp[e[i].to][1]);
	}
	if(son[x]>=2)
	{
		for(i=hr[x];i;i=e[i].nex)if(e[i].to!=fa[x]&&sw[e[i].to])
		{
			int v=dp[e[i].to][1];
			if(v>p.fi)p.se=p.fi,p.fi=v;
			else if(v>p.se)p.se=v;
		}
		dp[x][0]=max(dp[x][0],deg[x]+1+p.fi+p.se);
	}
	dp[x][0]=max(dp[x][0],dp[x][1]);
}
char s[MN];
int main()
{
	N=read();reg int i,x;
	for(i=1;i<N;++i) x=read(),ins(x,read());
	scanf("%s",s+1);
	for(i=1;i<=N;++i) c[i]=s[i]=='W',sW+=c[i];
	dfs1(1);dfs2(rt);dfs3(rt);
	return 0*printf("%d\n",ans-dp[rt][0]);
}