#include<cstdio>
#include<algorithm>
#include<vector>
#define N_ 101000
using namespace std;
int n, C[N_], chk[N_], S, U[N_], D[N_], res;
vector<int>E[N_];
char p[N_];
void DFS(int a, int pp) {
	if (p[a] == 'W')C[a] = 1;
	for (auto &x : E[a]) {
		if (x == pp)continue;
		DFS(x, a);
		C[a] += C[x];
	}
}
void Do(int a, int pp) {
	for (auto &x : E[a]) {
		if (x == pp)continue;
		Do(x, a);
		res = max(res, D[a] + D[x]);
		D[a] = max(D[a], U[a] + D[x]);
	}
	res = max(res, D[a]);
}
int main() {
	int i, a, b;
	scanf("%d", &n);
	for (i = 1; i < n; i++) {
		scanf("%d%d", &a, &b);
		E[a].push_back(b);
		E[b].push_back(a);
	}
	scanf("%s", p + 1);
	int rt = 0;
	for (i = 1; i <= n; i++) {
		if (p[i] == 'W')rt = i;
	}
	if (!rt) {
		puts("0");
		return 0;
	}
	DFS(rt, 0);
	for (i = 1; i <= n; i++) {
		if (!C[i])continue;
		int sz = 0;
		for (auto &t : E[i]) {
			if (C[t])sz++;
		}
		if ((sz % 2 == 1) == (p[i] == 'W')) {
			S += sz;
		}
		else {
			S += sz + 1;
			if(sz)U[i] = 1;
		}
	}
	Do(rt, 0);
	printf("%d\n", S - res * 2);
}