/*----------------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, cnt, ans, rt;
int w[maxn];
bool valid[maxn];
char s[maxn];
set<int> tr[maxn];
vector<int> g[maxn];

inline void remove(int u, int v){
    tr[u].erase(v);
    tr[v].erase(u);
    return;
}

inline pair<pii, pii> update(pair<pii, pii> x, pii y){
    if(x.fst <= y){
        x.snd = x.fst;
        x.fst = y;
    }
    else
        x.snd = max(x.snd, y);
    return x;
}

void del(int u){
    if(s[u] == 'W')
        return;
    if(tr[u].size() == 1){
        valid[u] = false;
        int v = *tr[u].begin();
        remove(u, v);
        del(v);
        return;
    }
}

pii dfs(int u, int p){
	//printf("u = %d\n" ,u);
    pair<pii, pii> nl = MP(MP(0, -1), MP(0, -1)),
                   any = MP(MP(0, -1), MP(0, -1));
    FOR(i, 0, g[u].size()){
        int v = g[u][i];
        if(!valid[v] || v == p)
            continue;
        pii res = dfs(v, u);
        nl = update(nl, MP(res.fst, v));
        any = update(any, MP(res.snd, v));
    }
    if(g[u].size() == 1 && ~p){
        return MP(-INF, w[u]);
    }
    if(nl.fst.snd == any.fst.snd){
        ans = max(ans, nl.fst.fst + any.snd.fst + w[u]);
        ans = max(ans, nl.snd.fst + any.fst.fst + w[u]);
    }
    else{
        ans = max(ans, nl.fst.fst + any.fst.fst + w[u]);
    }
    ans = max(ans, nl.fst.fst + nl.snd.fst + w[u]);
    ans = max(ans, any.snd.fst + nl.fst.fst + w[u]);
    //printf("u = %d ((%d,%d),(%d,%d)) ((%d,%d),(%d,%d))\n", u,
    //nl.fst.fst, nl.fst.snd, nl.snd.fst, nl.snd.snd,
    //any.fst.fst, any.fst.snd, any.snd.fst, any.snd.snd);
    return MP(nl.fst.fst + w[u], any.fst.fst + w[u]);
}

int main(){
	scanf("%d", &n);
    FOR(i, 1, n){
        int u, v;
        scanf("%d%d", &u, &v);
        --u; --v;
        tr[u].insert(v);
        tr[v].insert(u);
    }
    scanf("%s", s);
    if(n == 1){
		printf("%d\n", s[0] == 'W');
		return 0;
	}
    memset(valid, true, sizeof(valid));
    FOR(i, 0, n)
        del(i);
    res = -2;
    FOR(i, 0, n) if(valid[i]){
        for(set<int>::iterator it = tr[i].begin(); it != tr[i].end(); ++it)
            g[i].PB(*it);
        w[i] = (g[i].size() & 1) ^ (s[i] == 'W');
        res += w[i];
        if(!w[i])
            w[i] = -1;
		rt = i;
        res += 2;
        cnt += 1;
        w[i] += 1;
    }
/*    FOR(i, 0, n)
		printf("%d ", w[i]);
	puts("");
    FOR(i, 0, n) FOR(j, 0, g[i].size())
		printf("(%d -> %d)\n", i, g[i][j]);
*/  if(!cnt){
        puts("0");
        return 0;
    }
    if(cnt == 1){
        printf("%d\n", (s[rt] == 'W'));
        return 0;
    }
    dfs(rt, -1);
    //printf("%d %d\n", res, ans);
    printf("%d\n", res - max(0, ans));
	return 0;
}


Measured memory_bytes: 36608