#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define FASTIO
#define ALL(v) (v).begin(), (v).end()

#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/
const int MAXN = 120000;

int n;
vector<int> eds[MAXN];
int sz[MAXN];
string cl;

void dfs1(int v, int p) {
	sz[v] = (cl[v] == 'W');
	for (int u: eds[v]) {
		if (u == p)
			continue;
		dfs1(u, v);
		sz[v] += sz[u];
	}
	vector<int> tmp;
	for (int u: eds[v]) {
		if (u == p || sz[u])
			tmp.push_back(u);
	}
	eds[v] = tmp;
}

int fl[MAXN];

int dfs2(int v, int p) {
	int ans = 1;
	fl[v] = 1;
	for (int u: eds[v]) {
		if (u == p)
			continue;
		ans += dfs2(u, v);
	}
	return ans;
}

int cc[MAXN];
int gl = 0;

pair<int, int> dfs3(int v, int p) {
	int x = (cc[v] == 1 ? 1 : -1);
	pair<int, int> now = {0, x};
	for (int u: eds[v]) {
		if (u == p)
			continue;
		pair<int, int> tmp = dfs3(u, v);
		++tmp.first;
		++tmp.second;
		gl = max(gl, now.first + tmp.second);
		gl = max(gl, tmp.first + now.second);
		tmp.first += x;
		tmp.second += x;
		now.first = max(now.first, tmp.first);
		now.second = max(now.second, tmp.second);
	}
	return now;
}

int main() {
#ifdef BZ
	//freopen("in", "r", stdin);
#endif
#ifdef FASTIO
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
	cin >> n;
	for (int i = 0; i < n - 1; ++i) {
		int a, b;
		cin >> a >> b;
		--a, --b;
		eds[a].push_back(b);
		eds[b].push_back(a);
	}
	cin >> cl;
	for (int i = 0; i < n; ++i) {
		if (cl[i] == 'W')
			cc[i] = 1;
	}
	int st = 0;
	while (st < n && cl[st] == 'B')
		++st;
	if (st == n) {
		cout << 0 << "\n";
		return 0;
	}
	dfs1(st, -1);
	int size = dfs2(st, -1);
	int ans = (size - 1) * 2;
	for (int i = 0; i < n; ++i) {
		if (fl[i]) {
			cc[i] ^= (eds[i].size() % 2);
			if (cc[i])
				ans += 1;
		}
	}
	dfs3(st, -1);
	cout << ans - gl << "\n";
	return 0;
}