#include <bits/stdc++.h>
using namespace std;

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)-form-)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };


inline int ri() { int in; int y = scanf("%d", &in); return in; }
inline void oi(int i) { printf("%d\n", i); }
inline void od(double i) { printf("%.9f\n", i); }


template<typename E>
struct TreeDiameter {
	int N;
	vector<vector<E>>G;
	vector<LL> vw;
	TreeDiameter(const vector<vector<E>>& g, const vector<LL> &a = {}) : N(int(g.size())), G(g) {
		if ((int)a.size())vw = a;
		else vw = VL(N, 0);
	}
	PLL dfs(int v, int p) {
		PLL ret = PLL(0, v);
		for (auto u : G[v]) {
			int nx = u.to;
			if (nx == p)continue;
			PLL temp = dfs(nx, v);
			LL ecost = u.cost;
			temp.first += ecost;
			ret = max(ret, temp);
		}
		ret.first += vw[v];
		return ret;
	}

	pair<LL, PLL> build(int root) {
		PLL p = dfs(root, -1);
		PLL q = dfs(p.second, -1);
		return pair<LL, PLL>(q.first, PLL(p.second, q.second));
	}
};

template<typename E>
pair<LL, PLL> getTreeDiameter(const int root, const vector<vector<E>>& G, const vector<LL>& v = {}) {
	return TreeDiameter<E>(G, v).build(root);
}// 微妙らしい



template <class N, class E>
struct Rerooting {
	int n;
	const vector<vector<E>>& G;
	vector<N> subtreesum;
	vector<vector<N>> dp; // L
	void dfs1(int v, int p) {
		subtreesum[v] = N();
		for (auto e : G[v]) {
			int nx = e.to;
			if (nx == p) continue;
			dfs1(nx, v);
			subtreesum[v] = subtreesum[v] + subtreesum[nx].include_e(v, e);
		}
		subtreesum[v] = subtreesum[v].include_v(v);
	}
	void dfs2(int v, int p, N top) {
		int deg = int(G[v].size());
		dp[v] = vector<N>(deg + 1);
		dp[v][0] = N();
		for (int i = 0; i < deg; i++) {
			int nx = G[v][i].to;
			dp[v][i + 1] =
				dp[v][i] + (nx == p ? top : subtreesum[nx]).include_e(v, G[v][i]);
		}
		N rnode = N();
		dp[v].back() = dp[v].back().include_v(v);
		for (int i = deg - 1; i >= 0; i--) {
			dp[v][i] = (dp[v][i] + rnode).include_v(v);
			int nx = G[v][i].to;
			if (nx != p) dfs2(nx, v, dp[v][i]);
			rnode = rnode + (nx == p ? top : subtreesum[nx]).include_e(v, G[v][i]);
		}
	}
	Rerooting(const vector<vector<E>>& _g, int root) : n(int(_g.size())), G(_g), subtreesum(n), dp(n) {
		dfs1(root, -1);
		dfs2(root, -1, N());
	}
};

template <class N, class E> vector<vector<N>> Rerooting_get(const vector<vector<E>>& g, int root) {
	return Rerooting<N, E>(g, root).dp;
}
void solve_ARC097_F() {
	int N = ri();
	struct Edge
	{
		int to;
		int cost;
		Edge(int t, int c = 0) :to(t), cost(c) {}
	};

	vector<vector<Edge>>G(N);
	static vector<int>deg(N, 0);
	FOR(i, 0, N - 1) {
		int s = ri() - 1, t = ri() - 1;
		G[s].push_back(Edge(t));
		G[t].push_back(Edge(s));
		deg[s]++;
		deg[t]++;
	}
	static string s; cin >> s;

	// Gの更新
	VI nouse(N, 0);
	// nouseを決める
	{
		queue<int>q;
		FOR(i, 0, N) {
			if (deg[i] <= 1 && s[i] == 'B') {
				q.push(i);
				nouse[i] = 1;
			}
		}
		// black and deg==1を消す
		// トポソのノリ
		while (!q.empty()) {
			int v = q.front(); q.pop();
			for (auto u : G[v]) {
				int nx = u.to;
				if (nouse[nx])continue;
				deg[nx]--;
				if (deg[nx] <= 1 && s[nx] == 'B') {
					nouse[nx] = 1;
					q.push(nx);
				}
			}
		}
	}

	int root = -1;
	{
		// 残ったグラフの頂点のひとつをrootにする
		FOR(i, 0, N) {
			if (!nouse[i])root = i;
		}
		DD(De(nouse));
		// nouseじゃない辺なら張るをする
		vector<vector<Edge>>nxG(N); {
			FOR(v, 0, N) {
				for (auto u : G[v]) {
					int nx = u.to;
					if (!nouse[v] && !nouse[nx]) {
						nxG[v].push_back(Edge(nx));
					}
				}
			}
		}

		G = nxG;
	}
	// 適用できない場合(これ発見するの厳しい)
	if (accumulate(ALL(nouse), 0LL) >= N - 2) {
		cout << N - accumulate(ALL(nouse), 0LL) << endl;
		DD(de("end"));
		return;
	}
	DD(de(root));
	int tourcost = 0;
	// Gの巡回コスト
	VL co(N);
	{
		function<int(int, int)>f = [&](int v, int p) {
			int deg = SZ(G[v]);
			int ret = (deg & 1) ^ (s[v] == 'W');
			co[v] = ret;
			for (auto nx : G[v]) {
				if (nx.to == p)continue;
				ret += f(nx.to, v) + 2;
			}
			return ret;
		};
		tourcost = f(root, -1);
	}
	DD(de(tourcost));

	// Gの取れる最大パス長
	//TreeDiameter<Edge> Tree(G, co);
	//int mx = Tree.build(root).first;
	//int mx = 2*getTreeDiameter(root, G, co).first;
	// 式変形をするとでる


	static int mx = 0;
	// カス
	// 頂点ベースじゃん
	{
		struct Node {
			PII top2;
			Node(PII e = PII(-INF, -INF)) :top2(e) {}
			Node include_e(int, const Edge&) const {
				PII res = top2;
				res.first = max(1, res.first + 1);
				res.second = 0;

				return Node(res);
				//// e.toがアレ．
				//int nx = e.to;
				//int degs = deg[nx];
				//degs--;
				//int cost = (degs & 1) ^ (s[nx] == 'W');
				//if (!cost)cost = -1;
				//int a = top2.first + cost;
				//int b = 0;
				//PII res = PII(max(a, b), min(a, b));
				//return Node(res);
			}

			Node operator + (const Node& r) const {
				PII res = top2;
				for (auto it : { r.top2.first,r.top2.second }) {
					//if (it == 0)continue;
					if (res.first < it) {
						res.second = res.first;
						res.first = it;
					}
					else if (res.second < it) {
						res.second = it;
					}
				}
				return Node(res);
			}
			Node include_v(int v) const {
				// ここ
				int degs = deg[v];
				//degs--;
				int cost = (degs & 1) ^ (s[v] == 'W');
				if (!cost)cost = -1;

				// 更新だけやる　
				//mx = max(mx, max(0, top2.first) + max(0, top2.second) + cost);


				int a = top2.first;
				int b = top2.second;
				PII res = top2;
				if (res.first == -INF)res.first = (cost);
				else res.first += cost;
				res.first = max(res.first, 0);
				res.second = 0;
				DD(de(cost, top2.first, top2.second,res.first,res.second));
				return Node(res);
			}
		};

		auto tree_res = Rerooting_get<Node>(G, root);
		DD(de(mx));
		DD(De(deg))
			FOR(i, 0, N) {
			if (nouse[i])continue;
			Node it = tree_res[i].back();
			DD(de(i + 1, it.top2.first, it.top2.second));
			mx = max(mx, it.top2.first);
		}
	}
	DD(de(tourcost, mx));
	oi(tourcost - mx);

}
int main() {
	solve_ARC097_F();
}


Measured memory_bytes: 25432