#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n,s,u,md,f[N];
char c[N];
vector<int> e[N];
int dfs(int x,int fa)
{
	int ret = (c[x] == 'W');int deg = fa > 0;
	for(int i = 0;i < e[x].size();i ++)
	{
		int y = e[x][i];
		if(y != fa && dfs(y,x))
			ret = 1,s += 2,deg ++;
	}
	if(ret)
	{
		f[x] = (deg&1) != (c[x] == 'W');
		s += f[x];f[x] *= 2;
	}
	else
		f[x] = -1;
	return ret;
}
void dfs2(int x,int fa,int d)
{
	d += f[x];if(d >= md) md = d,u = x;
	for(int i = 0;i < e[x].size();i ++)
	{
		if(e[x][i] != fa && f[e[x][i]] != -1)
			dfs2(e[x][i],x,d);
	}
}
int main()
{
	scanf("%d",&n);
	for(int i = 1;i < n;i ++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		e[x].push_back(y);
		e[y].push_back(x);
	}
	scanf("%s",c+1);
	for(int i = 1;i <= n;i ++)
		if(c[i] == 'W')
		{
			dfs(i,0);md = -N;
			dfs2(i,0,0);md = -N;
			dfs2(u,0,0);
			printf("%d\n",s > 1?s-md:1);
			return 0;
		}
	printf("0\n");
	return 0;
}