#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pi = pair<int, int>;
const int MAXN = 100005;

int n;
char str[MAXN];
vector<int> gph[MAXN];
int deg[MAXN], vis[MAXN], val[MAXN];
int dp[MAXN][2];

void dfs2(int x, int p){
	vis[x] = 1;
	for(auto &i : gph[x]){
		if(i != p) dfs2(i, x);
	}
}

int dfs3(int x, int p){
	int ret = 0;
	dp[x][1] = val[x];
	for(auto &i : gph[x]){
		if(i != p){
			ret = max(ret, dfs3(i, x));
			dp[x][0] = max(dp[x][0], dp[i][0] + val[x]);
			dp[x][1] = max(dp[x][1], dp[i][1] + val[x]);
		}
	}
	int cur0max = 0;
	int cur1max = val[x];
	for(auto &i : gph[x]){
		if(i != p){
			ret = max(ret, cur0max + dp[i][1]);
			ret = max(ret, cur1max + dp[i][0]); 
			cur0max = max(cur0max, dp[i][0] + val[x]);
			cur1max = max(cur1max, dp[i][1] + val[x]);
		}
	}
	return ret;
}

int solve(int x){
	int ret = 0;
	dfs2(x, 0);
	for(int i=1; i<=n; i++){
		val[i] = (str[i] == 'W') ^ (gph[i].size() & 1);
		if(vis[i]) ret += gph[i].size() + val[i];
	}
	for(int i=1; i<=n; i++){
		if(vis[i]) return ret - 2 * dfs3(i, 0);
	}
	assert(0);
}

int dfs(int x, int p, vector<pi> &v){
	int ret = (str[x] == 'W');
	for(auto &i : gph[x]){
		if(i != p){
			int val = dfs(i, x, v);
			ret += val;
			if(val) v.emplace_back(i, x);
		}
	}
	return ret;
}

int main(){
	scanf("%d",&n);
	vector<pi> ed;
	for(int i=1; i<n; i++){
		int s, e; scanf("%d %d",&s,&e);
		gph[s].push_back(e);
		gph[e].push_back(s);
	}
	scanf("%s", str + 1);
	if(count(str + 1, str + n + 1, 'W') == 0){
		cout << 0 << endl;
		return 0;
	}
	for(int i=1; i<=n; i++){
		if(str[i] == 'W'){
			vector<pi> edg;
			dfs(i, 0, edg);
			for(int i=1; i<=n; i++) gph[i].clear();
			for(auto &i : edg){
				gph[i.first].push_back(i.second);
				gph[i.second].push_back(i.first);
				deg[i.first]++;
				deg[i.second]++;
			}
			cout << solve(i) << endl;
			return 0;
		}	
	}
}
