/*----------------by syr----------------*/
/*

         iii                  ii
     rBQBBBBBBE       BBR iBBBBQBBL     XBBBBBBQBBBBB
   iBBQJ    7BBB      BBsSBBr   BBQ      i      cBBB
  rBBU       iBBw     BBBQi     HBBi           KBBi
  BBH         BB5    iBBB       isL          wBB5
 GBB         iBBi    6BB                   iBBB
 BBQ         BQB     BBD                  QBBi
 BBB        BQB     iQBi                1BBv
 sBBg     wBBB      QBB               iBBB
  7BBBBBBBBBi       BBR              wBBBBBBBBBBBBB
     irvi           ii               ii    i i iii
                i5U
               BBB
               BB7
              1BB
      iPBBBBBKBBR    JBR1       rQBO   BR  UBQP  iBBQi
    7BBBGs7sXBBBi     QBBr     gBBE   rBB BB2BB7HBZQBB
   QBBi      sBQ       BBB   iBBB     SQBBR  BBBB  cBQ
  gBQ        BBg        BBB KBBi      MBBH   BBB   BBs
 iBBv       iBBi         QBBBL        BBR   pBB   iBB
 pBB        BBB         iBBBB        iBB    BBL   KBB
 MBB       BBBR        BBB JBBi      DBR   iBQ    BBL
 GBB     7BBBB2      PBBH   BBBi     BQr   DBB   iBB
  BQBXwgBBP BB7    1BBB      BBQ7   1BB    BBc   BBB
   2BBBBw   BB    EBBS        QBBi  HBa   iBB    BB7
*/
#include<bits/stdc++.h>

using namespace std;

#define PH push
#define MP make_pair
#define PB push_back
#define fst first
#define snd second
#define FOR(i, x, y) for(int i = (x); i < (y); ++i)
#define REP(i, x, y) for(int i = (x); i <= (y); ++i)
#define x0 x0123456789
#define y0 y0123456789
#define x1 x1234567890
#define y1 y1234567890
#define x2 x2345678901
#define y2 y2345678901
typedef double db;
typedef long long ll;
typedef long double ldb;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9 + 7;
const int maxn = 1e5 + 5;

int n, res, ans;
int a[maxn], w[maxn], deg[maxn];
int f[maxn][2], g[maxn];
bool del[maxn];
char s[maxn];
queue<int> q;
vector<int> gph[maxn];

void upd(int &a, int &b, int c){
    if(c >= a)
        b = a,
        a = c;
    else if(c >= b)
        b = c;
    return;
}

void calcF(int u, int p){
    int mx1 = -1, mx2 = -1;
    f[u][0] = w[u],
    f[u][1] = 0;
    FOR(i, 0, gph[u].size()){
        int v = gph[u][i];
        if(v == p || del[v])
            continue;
        calcF(v, u);
        f[u][0] = max(f[u][0], f[v][0] + w[u]);
        upd(mx1, mx2, f[v][0]);
    }
    if(~mx2)
        f[u][1] = mx1 + mx2 + w[u];
    return;
}

void calcG(int u, int p){
    int mx1 = -1, mx2 = -1;
    FOR(i, 0, gph[u].size()){
        int v = gph[u][i];
        if(v == p || del[v])
            continue;
        upd(mx1, mx2, f[v][0]);
    }
    FOR(i, 0, gph[u].size()){
        int v = gph[u][i];
        if(v == p || del[v])
            continue;
        if(f[v][0] == mx1)
            g[v] = mx2;
        else
            g[v] = mx1;
        g[v] += w[v];
        calcG(v, u);
    }
    return;
}

int main(){
    scanf("%d", &n);
    FOR(i, 1, n){
        int u, v;
        scanf("%d%d", &u, &v);
        --u; --v;
        gph[u].PB(v);
        gph[v].PB(u);
        ++deg[u], ++deg[v];
    }
    scanf("%s", s);
    FOR(u, 0, n)
        if(gph[u].size() == 1 && s[u] == 'B')
            q.PH(u);
    while(q.size()){
        int u = q.front();
        q.pop();
        del[u] = 1;
        FOR(i, 0, gph[u].size()){
            int v = gph[u][i];
            if(!del[v]){
                --deg[v];
                if(deg[v] == 1 && s[v] == 'B')
                    q.PH(v);
            }
        }
    }
    // the ans should be
    //   the number of verts with (a[i] == 1) in total
    // - the number of verts with (a[i] == 1) on the path
    // + the number of verts with (a[i] == 0) on the path
    // - the length of the path
    FOR(i, 0, n) if(!del[i]){
        a[i] = (s[i] == 'W') ^ (deg[i] & 1);
        w[i] = a[i] ? 1 : (-1);
        ++w[i];
        res += a[i];
		res += 2;
    }
    if(!res){
		puts("0");
		return 0;
	}
    res -= 2;
	int root;
	for(root = 0; root < n && del[root]; ++root);
    calcF(root, -1);
    calcG(root, -1);
    FOR(u, 0, n) if(!del[u]){
        ans = max(ans, f[u][0] + g[u] - w[u]);
        ans = max(ans, f[u][1]);
    }
    printf("%d\n", res - ans);
	return 0;
}


Measured memory_bytes: 15232