# include <bits/stdc++.h>
 
using namespace std;
 
typedef long long                                        ll;
typedef long double                                      ld;
typedef pair <int, int>                                  pii;
 
# define A                                               first
# define B                                               second
# define endl                                            '\n'
# define sep                                             ' '
# define all(x)                                          x.begin(), x.end()
# define kill(x)                                         return cout << x << endl, 0
# define InTheNameOfGod                                  ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
 
ll power(ll a, ll b, ll md) {return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));}
 
const int xn = 1e5 + 10;
const int xm = - 20 + 10;
const int sq = 320;
const int inf = 1e9 + 10;
const ll INF = 1e18 + 10;
const int mod = 1e9 + 7;
const int base = 257;

int n, d[xn], sz[xn], ted, ans = inf, res, part[xn], root;
int tot, L[xn], R[xn], ptr, seg[xn << 2], lazy[xn << 2], p[xn];
vector <int> adj[xn];
string s;
bool flag[xn];

void build(int id, int l, int r){
	if (r - l == 1){
		seg[id] = tot - part[p[l]] + flag[p[l]];
		return;
	}
	int mid = l + r >> 1;
	build(id << 1, l, mid);
	build(id << 1 | 1, mid, r);
	seg[id] = min(seg[id << 1], seg[id << 1 | 1]);
}
void shift(int id, int l, int r){
	if (!lazy[id]) return;
	seg[id] += lazy[id];
	if (r - l > 1){
		lazy[id << 1] += lazy[id];
		lazy[id << 1 | 1] += lazy[id];
	}
	lazy[id] = 0;
}
void update(int id, int l, int r, int ql, int qr, int val){
	shift(id, l, r);
	if (qr <= l || r <= ql) return;
	if (ql <= l && r <= qr){
		lazy[id] += val;
		shift(id, l, r);
		return;
	}
	int mid = l + r >> 1;
	update(id << 1, l, mid, ql, qr, val);
	update(id << 1 | 1, mid, r, ql, qr, val);
	seg[id] = min(seg[id << 1], seg[id << 1 | 1]);
}
void dfs3(int v, int par){
	ans = min(ans, seg[1]);
	for (int u : adj[v]){
		if (u == par) continue;
		update(1, 1, n + 1, 1, n + 1, - flag[u]);
		update(1, 1, n + 1, L[u], R[u], flag[u] + flag[v]);
		dfs3(u, v);
		update(1, 1, n + 1, 1, n + 1, flag[u]);
		update(1, 1, n + 1, L[u], R[u], - flag[u] - flag[v]);
	}
}
void dfs2(int v, int par){
	part[v] += flag[v];
	L[v] = ++ ptr;
	R[v] = L[v] + 1;
	p[ptr] = v;
	for (int u : adj[v]){
		if (u == par) continue;
		part[u] += part[v];
		dfs2(u, v);
		R[v] = R[u];
	}
}
void dfs(int v, int par){
	flag[v] = (s[v - 1] == 'W');
	sz[v] = flag[v];
	for (int u : adj[v]){
		if (u == par) continue;
		dfs(u, v);
		sz[v] += sz[u];
		d[v] += (sz[u] > 0);
	}
	d[v] += (sz[v] < ted);
	res += d[v] - 1;
	if (!flag[v] && d[v] == 1) flag[v] = false;
	else if (d[v] % 2 == flag[v]){
		flag[v] = false;
		++ res;
	}
	else flag[v] = true;
	tot += flag[v];
}

int main(){
    InTheNameOfGod;
    
	cin >> n;
	for (int i = 0; i < n - 1; ++ i){
		int v, u;
		cin >> v >> u;
		adj[v].push_back(u);
		adj[u].push_back(v);
	}
	cin >> s;
	for (char c : s) ted += c == 'W';
	if (!ted) kill(0);
	if (ted == 1) kill(1);
	for (int i = 1; i <= n; ++ i) if (s[i - 1] == 'W') root = i;
	dfs(root, 0);
	dfs2(root, 0);
	build(1, 1, n + 1);
	dfs3(root, 0);
	cout << res + ans + ans << endl;
	
    return 0;
}


Measured memory_bytes: 21432