import std.stdio, std.algorithm, std.range, std.conv, std.string, std.math, std.container;
import core.stdc.stdio;
// foreach, foreach_reverse, writeln

void main() {
	int n;
	scanf("%d\n", &n);
	int[][] g = new int[][n];
	int[] degree = new int[n];
	foreach (i; 0..n-1) {
		int x, y;
		scanf("%d %d\n", &x, &y);
		--x; --y;
		g[x] ~= y;
		g[y] ~= x;
		degree[x]++;
		degree[y]++;
	}
	string c = readln().chomp;

	bool[] live = new bool[n];
	live[] = true;

	alias Queue = DList!int;
	auto q = new Queue();
	foreach (i; 0..n) {
		if (degree[i] == 1) {
			q.insertBack(i);
		}
	}

	int L = n;
	while (!q.empty) {
		int v = q.front();
		q.removeFront();
		if (c[v] == 'W') continue;
		live[v] = false; L--;
		foreach (u; g[v]) {
			degree[u]--;
			if (degree[u] == 1) {
				q.insertBack(u);
			}
		}
	}
	if (L == 0) {
		writeln(0);
		return;
	}
	int base = L*2;

	int[] score = new int[n];
	foreach (v; 0..n) {
		if (!live[v]) continue;
		score[v] = (degree[v] + (c[v]=='B'?0:1)) % 2;
		base += score[v];
	}

	int best = 0;
	int dfs(int v, int parent=-1) {
		int ret = score[v];
		foreach (u; g[v]) {
			if (u == parent) continue;
			if (!live[u]) continue;
			int s = dfs(u,v);
			best = max(best, ret+s);
			ret = max(ret, s+score[v]);
		}
		return ret;
	}
	foreach (v; 0..n) {
		if (!live[v]) continue;
		dfs(v);
		break;
	}

	writeln(base-best*2-2);
}