{"raw_statement":[{"iden":"problem statement","content":"There is a tree with $N$ vertices numbered $1$ through $N$. The $i$\\-th edge connects Vertex $x_i$ and $y_i$. Each vertex is painted white or black. The initial color of Vertex $i$ is represented by a letter $c_i$. $c_i$ $=$ `W` represents the vertex is white; $c_i$ $=$ `B` represents the vertex is black.\nA cat will walk along this tree. More specifically, she performs one of the following in one second repeatedly:\n\n*   Choose a vertex that is adjacent to the vertex where she is currently, and move to that vertex. Then, invert the color of the destination vertex.\n*   Invert the color of the vertex where she is currently.\n\nThe cat's objective is to paint all the vertices black. She may start and end performing actions at any vertex. At least how many seconds does it takes for the cat to achieve her objective?"},{"iden":"constraints","content":"*   $1$ $≤$ $N$ $≤$ $10^5$\n*   $1$ $≤$ $x_i,y_i$ $≤$ $N$ ($1$ $≤$ $i$ $≤$ $N-1$)\n*   The given graph is a tree.\n*   $c_i$ $=$ `W` or $c_i$ $=$ `B`."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$\n$x_1$ $y_1$\n$x_2$ $y_2$\n$:$\n$x_{N-1}$ $y_{N-1}$\n$c_1c_2..c_N$"},{"iden":"sample input 1","content":"5\n1 2\n2 3\n2 4\n4 5\nWBBWW"},{"iden":"sample output 1","content":"5\n\nThe objective can be achieved in five seconds, for example, as follows:\n\n*   Start at Vertex $1$. Change the color of Vertex $1$ to black.\n*   Move to Vertex $2$, then change the color of Vertex $2$ to white.\n*   Change the color of Vertex $2$ to black.\n*   Move to Vertex $4$, then change the color of Vertex $4$ to black.\n*   Move to Vertex $5$, then change the color of Vertex $5$ to black."},{"iden":"sample input 2","content":"6\n3 1\n4 5\n2 6\n6 1\n3 4\nWWBWBB"},{"iden":"sample output 2","content":"7"},{"iden":"sample input 3","content":"1\nB"},{"iden":"sample output 3","content":"0"},{"iden":"sample input 4","content":"20\n2 19\n5 13\n6 4\n15 6\n12 19\n13 19\n3 11\n8 3\n3 20\n16 13\n7 14\n3 17\n7 8\n10 20\n11 9\n8 18\n8 2\n10 1\n6 13\nWBWBWBBWWWBBWWBBBBBW"},{"iden":"sample output 4","content":"21"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}