#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define forn(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
#define ford(i, a, n) for (int i = (int)(n) - 1; i >= (int)(a); --i)
#define fore(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second
#define trace(a)\
    for (auto i : a) cerr << i << ' ';\
    cerr << '\n'
#define eb emplace_back

#ifndef M_PI
const ld M_PI = acos(-1.0);
#endif

template<typename T>
inline void setmax(T& a, T b) {
    if (a < b) a = b;
}

template<typename T>
inline void setmin(T& a, T b) {
    if (a > b) a = b;
}

template<typename T, typename S>
istream& operator>> (istream& in, pair<S, T>& p) {
    in >> p.fs >> p.sn;
    return in;
}
template<typename T, typename S>
ostream& operator<< (ostream& out, pair<S, T>& p) {
    out << p.fs << ' ' << p.sn << ' ';
    return out;
}

template<typename T>
istream& operator>> (istream& in, vector<T>& v) {
    for (T& x : v) in >> x;
    return in;
}
template<typename T>
ostream& operator<< (ostream& out, vector<T>& v) {
    for (T& x : v) out << x << ' ';
    return out;
}

const ld eps = 1e-9;
const int INF = 2000000000;
const ll LINF = 1ll * INF * INF;
const ll MOD = 1000000007;

const int N = 1e5 + 10;
vector<int> e[N];
int bad[N];

int down[N], lca[N];
int deg[N], rem[N];

void dfs(int u, int par) {
    int fst = 0, snd = 0;
    for (int v : e[u]) {
        if (v == par) continue;
        if (rem[v]) continue;
        dfs(v, u);
        if (down[v] > fst) {
            snd = fst;
            fst = down[v];
        } else if (down[v] > snd)
            snd = down[v];
    }
    lca[u] = fst + snd + bad[u];
    down[u] = fst + bad[u];
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); 
    srand((unsigned)chrono::high_resolution_clock::now().time_since_epoch().count());
    int n;
    cin >> n;
    forn(i, 1, n) {
        int u, v;
        cin >> u >> v;
        --u, --v;
        e[u].eb(v);
        e[v].eb(u);
    }
    string s;
    cin >> s;
    forn(i, 0, n)
        if (s[i] == 'W')
            bad[i] = 1;
    int ans = 2 * (n - 1);
    forn(i, 0, n)
        deg[i] = e[i].size();
    queue<int> q;
    forn(i, 0, n)
        if (deg[i] == 1 && !bad[i])
            q.push(i);
    while (!q.empty()) {
        int u = q.front();
        q.pop();
        ans -= 2;
        rem[u] = 1;
        for (int v : e[u]) {
            --deg[v];
            if (deg[v] == 1 && !bad[v])
                q.push(v);
        }
    }
    if (ans <= 0) {
        ans = 0;
        forn(i, 0, n)
            if (!rem[i] && bad[i])
                ++ans;
        cout << ans << '\n';
        return 0;
    }
    forn(i, 0, n)
        if (deg[i] % 2)
            bad[i] ^= 1;
    forn(i, 0, n) if (!rem[i])
        ans += bad[i];
    int root = 0;
    while (rem[root]) ++root;
    dfs(root, -1);
    int path = 0;
    forn(i, 0, n)
        setmax(path, lca[i]);
    ans -= 2 * path;
    cout << ans << '\n';
}


Measured memory_bytes: 12496