#include <bits/stdc++.h>

#define MAX_N 100000

#define sqrInf 999999999

using namespace std;

int n;
int rez;
int nodes;

const int WHITE = 1;
const int BLACK = 0;

vector <int> g[MAX_N + 1];

int cul[MAX_N + 1];
int viz[MAX_N + 1];
int dist[MAX_N + 1][2];

int st[MAX_N + 1];
int dr[MAX_N + 1];
int cost[MAX_N + 1];

int white[MAX_N + 1];
int gradul[MAX_N + 1];
int del[MAX_N + 1];

void add(int a, int b)
{
    g[a].push_back(b);
}

string s;

void readFile()
{
    cin >> n;

    int i;
    int a, b;
    for(i = 1; i <= n - 1; i ++)
    {
        cin >> a >> b;
        add(a, b);
        add(b, a);
    }

    cin >> s;
}

void getCuls()
{
    int i;
    for(i = 1; i <= n; i ++)
    {
        if(s[i - 1] == 'W')
            cul[i] = WHITE;

        else
            cul[i] = BLACK;
    }
}

int que[MAX_N + 1];
int start;
int backup;

void delNodes()
{
    nodes = n;

    int i;
    int st = 1, dr = 0;
    for(i = 1; i <= n; i ++)
    {
        if(g[i].size() <= 1 && cul[i] == BLACK)
        {
            que[++ dr] = i;
            del[i] = 1;
            viz[i] = 1;
        }

        gradul[i] = g[i].size();
    }

    while(st <= dr)
    {
        int cr = que[st ++];
        nodes --;
        for(auto u : g[cr])
        {
            gradul[u] --;
            if(viz[u] == 0 && gradul[u] <= 1 && cul[u] == BLACK)
            {
                del[u] = viz[u] = 1;
                que[++ dr] = u;
            }
        }
    }

    for(i = 1; i <= n; i ++)
    {
        if(viz[i] == 0)
        {
            if(start == 0)
                start = i;
        }
    }
}

void dfs(int a)
{
    viz[a] = 1;
    st[a] = 0;
    dr[a] = 0;
    cost[a] = 0;
    white[a] = (cul[a] == WHITE);

    int add = sqrInf;
    int cati = 0;
    int adr = sqrInf;
    int grad = 0;

    for(auto u : g[a])
    {
        if(viz[u] == 0)
        {
            grad ++;

            dfs(u);

            white[a] += white[u];

            if(white[u] != 0)
            {
                cati ++;
                st[a] += cost[u];
                dr[a] += cost[u];
                add = min(add, st[u] - cost[u]);
                adr = min(adr, dr[u] - cost[u]);

                cost[a] += cost[u];
            }
        }
    }

    if(a != start)
    {
        cost[a] += ((cul[a] + 1 + cati) & 1);
        cost[a] += cati << 1;
    }

    st[a] += add;
    st[a] += (cati << 1) - 1;
    st[a] += ((cul[a] + cati) & 1);

    dr[a] += adr;
    dr[a] += (cati << 1) - 1;
    dr[a] += ((cul[a] + 1 + cati - 1) & 1);

    if(white[a] == 0)
    {
        st[a] = 0;
        dr[a] = 1;
        cost[a] = 1;
    }

    if(cati == 0)
    {
        cost[a] = (cul[a] == BLACK);
        st[a] = (cul[a] == WHITE);
        dr[a] = (cul[a] == BLACK);
    }
}

void getDp()
{
    dfs(start);
}

void comp(int &mn1, int &mn2, int &nr1, int &nr2, int val, int u)
{
    if(val - cost[u] <= mn1)
    {
        mn2 = mn1;
        mn1 = val - cost[u];

        nr2 = nr1;
        nr1 = u;
    }

    else
        if(val - cost[u] < mn2)
        {
            mn2 = val - cost[u];
            nr2 = u;
        }
}

int rezul;

int getCost(int mst, int mdr)
{
    if(mst == mdr)
        return sqrInf;

    if(mst == 0 || mdr == 0)
        return sqrInf;

    int cul1 = (gradul[start] - 1 + cul[start]) & 1;

    return cul1 + cost[start] - cost[mst] - cost[mdr] + st[mst] + dr[mdr] + (gradul[start] << 1) - 2;
}

void getRez()
{
    if(nodes <= 1)
    {
        rez = nodes;
        return;
    }

    if(gradul[start] == 1)
    {
        for(auto u : g[start])
        {
            if(del[u] == 0)
                rez = min(rez, cul[start] + dr[u] + 1);
        }

        return;
    }

    int mst1 = sqrInf, st1 = 0;
    int mst2 = sqrInf, st2 = 0;
    int mdr1 = sqrInf, dr1 = 0;
    int mdr2 = sqrInf, dr2 = 0;

    for(auto u : g[start])
    {
        if(del[u] == 0)
        {
            comp(mst1, mst2, st1, st2, st[u], u);
            comp(mdr1, mdr2, dr1, dr2, dr[u], u);
        }
    }

    rez = min(rez, getCost(st1, dr1));
    rez = min(rez, getCost(st1, dr2));
    rez = min(rez, getCost(st2, dr1));
    rez = min(rez, getCost(st2, dr2));
}

int viz2[MAX_N + 1];

void diam(int a, int cr)
{
    viz2[a] = 1;

    for(auto u : g[a])
    {
        if(viz2[u] == 0 && del[u] == 0)
        {
            dist[u][cr] = dist[a][cr] + 1;
            diam(u, cr);
        }
    }
}

int stDiam, drDiam;

void getMx(int &mx, int cr, int &nr)
{
    mx = 0;
    nr = 0;

    int i;
    for(i = 1; i <= n; i ++)
    {
        if(dist[i][cr] > mx)
        {
            mx = dist[i][cr];
            nr = i;
        }
    }
}

void getDiam()
{
    diam(start, 0);

    int mx;
    int st;
    getMx(mx, 0, st);

    memset(viz2, 0, sizeof(viz2));
    for(int i = 1; i <= n; i ++)
        dist[i][0] = 0;
    diam(st, 0);

    int dr;
    getMx(mx, 0, dr);

    memset(viz2, 0, sizeof(viz2));
    diam(dr, 1);

    start = 0;
    int i;
    for(i = 1; i <= n; i ++)
    {
        if(dist[i][0] + dist[i][1] == dist[dr][0] &&
           (dist[i][0] == (dist[dr][0] >> 1) || dist[i][1] == (dist[dr][0] >> 1)))
        {

            if(start == 0)
                start = i;

            else
                backup = i;
        }
    }
}

void solve()
{
    getCuls();

    delNodes();

    rez = sqrInf;

    getDiam();

    for(int j = 1; j <= n; j ++)
        viz[j] = del[j];

    getDp();

    getRez();

    if(backup != 0)
    {
        for(int i = 1; i <= n; i ++)
            viz[i] = del[i];

        start = backup;

        getDp();

        getRez();
    }
}

void printFile()
{
    cout << rez << "\n";
}

int main()
{
    readFile();

    solve();

    printFile();

    return 0;
}


Measured memory_bytes: 14592